Apache2Triad Help, Support and Development Forum Index Search Profile Log in to check your private messages Log in Register Memberlist Attachments Statistics Crew/Ranks Archive
 Fake Sendmail, and Telnetd
Google
Post new topic Reply to topic
Author Message
Joshua Meadows (DemoRic)
support
support


Joined: 29 Dec 2004
Posts: 783
Location: S.E. Kansas

PostPosted: Mon Sep 05, 2005 2:44 am Reply with quoteBack to top

I thought these were pretty funny, They could also be adapted to let you know when persons are trying to probe your site for known exploits.
Anyways,

Code:
#!C:/apache2triad/perl/bin/perl.exe
#Fake Telnetd
use Socket;

$port=23;
$login="\n\rlogin:";
$password="password:";
$banner="\n\r\n\rUnix(r) System V Release 4.0 (brooder)\n\r";
$fail="login incorrect.\n\r";


socket(S,AF_INET,SOCK_STREAM,$protocol) || die "socket: $!";

$sockaddr='S n a4 x8';

$this=pack($sockaddr,AF_INET,$port,"\0\0\0\0");

bind(S,$this) || die "bind: $!";

listen(S,10) || die "listen: $!";

select(S);
$|=1;
select(STDOUT);

while(1) {
($addr= accept(NS,S)) || die "accept: $!";

   select(NS);
   $|=1;
   select(STDOUT);

#
#here we should fork. but damn windog doesn't support this. crap.
# Any ideas?
      ($af,$port,$inetaddr)=unpack($sockaddr,$addr);
      @inetaddr=unpack('C4',$inetaddr);
      ($i1,$i2,$i3,$i4)=@inetaddr;
      $ipaddr="$i1.$i2.$i3.$i4";
      print "connected from $ipaddr\n";
      
      print NS $banner;
      print NS $login;
      while(<NS>) {
         print "attempt to log in as $_\n";
         print NS "$password";
         
         $ll=<NS> || last;
         sleep 5;
         print "tried password $ll. Login incorrect is given\n";
         print NS $fail;
         print NS $login;
      }
      print "$ipaddr disconnected\n";
      
      close(NS);
   }


Code:
#!C:/apache2triad/perl/bin/perl.exe
#FAKE SENDMAIL
use Socket;

$port=25;
$hostname="yoursite.com"; # does windog have gethostbyname?
$banner="220 yoursite.com ESMTP Sendmail 8.6.1/8.5.0\n\r"; # date should be aslo here
$fail="500 Command unrecognized:";



socket(S,AF_INET,SOCK_STREAM,$protocol) || die "socket: $!";

$sockaddr='S n a4 x8';

$this=pack($sockaddr,AF_INET,$port,"\0\0\0\0");

bind(S,$this) || die "bind: $!";

listen(S,10) || die "listen: $!";

select(S);
$|=1;
select(STDOUT);

while(1) {
($addr= accept(NS,S)) || die "accept: $!";

   select(NS);
   $|=1;
   select(STDOUT);

#
#here we should fork. but damn windog doesn't support this. crap.
# Any ideas?
      ($af,$port,$inetaddr)=unpack($sockaddr,$addr);
      @inetaddr=unpack('C4',$inetaddr);
      ($i1,$i2,$i3,$i4)=@inetaddr;
      $ipaddr="$i1.$i2.$i3.$i4";
      print "connected from $ipaddr\n";
      
      print NS $banner;
      while(<NS>) {
      if (/EHLO/i) {
         print NS "Hello $ipaddr. nice to meet you\n\r";
      } else {
       print NS "$fail $_\r";
       print "tried $_";
       }
      }
      print "$ipaddr disconnected\n";
      
      close(NS);
   }
View user's profileSend private messageYahoo MessengerICQ Number
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT