He He, This is a dandy little one.
Mark G ----- Original Message ----- From: "Kipp, James" <[EMAIL PROTECTED]> Date: Wednesday, July 9, 2003 7:45 am Subject: RE: Low Level Socket Programming > > > > hello, > > I have written a tcp socket server using the Perl Cookbook > > and Use Socket. This is nice an works well. However, i want > > to write a > > server that can listen for a special packet. So i need to get down > > futher that the Perl Cookbook shows. I want to see each packet and > > be able to look at its window size, what flags are set, payload > > size..etc..etc. I would also like the ability to make packets on > > a low level. Something like Net::RawIP looks good for making.. > > but how could i get my socket server to give me access to > > each packet... > > i.e. let me make the handshake and everything. > > Here is an example from perlmonks. HTH. > --- > !/usr/bin/perl > # IP-Packet A TCP Packet Generator written in Perl > # Date 15.07.2001 > # Programmed by <<<ByteBeater>>> [ [EMAIL PROTECTED] ] > # <<<ByteForge>>> > # http://www.bytebeater.de > use Net::RawIP; > > if($ARGV[0] eq "-c") > { > print "Reading $ARGV[1]\n"; > %config = readhash($ARGV[1]); > $config{'flag'} = lc($config{'flag'}); > } > elsif(($ARGV[0] eq "-h") || ($ARGV[0] eq "-?") || ($ARGV[0] eq > "--help")) > { > &help; > } > else > { > print "Give me a network device: "; > $device = <>; > chomp($device); > $config{'device'} = $device; > > print "What host do ya want to spoof? "; > $spoof = <>; > chomp($spoof); > $config{'spoof'} = $spoof; > > print "Tell me the target host: "; > $target = <>; > chomp($target); > $config{'target'} = $target; > > print "Source port: "; > $sport = <>; > chomp($sport); > $config{'sourceport'} = $sport; > > print "Target port: "; > $tport = <>; > chomp($tport); > $config{'targetport'} = $tport; > > print "Give me a flag: "; > $flag = <>; > chomp($flag); > $flag = lc($flag); > $config{'flag'} = $flag; > > print "How much packets shall I send? "; > $number = <>; > chomp $number; > $config{'number'} = $number; > } > > while(($key,$value) = each %config) > { > print "$key -- $value\n"; > } > > $packet = new Net::RawIP; > $packet->set({ip => {saddr => $config{'spoof'},daddr => > $config{'target'}} ,tcp => {source => $config{'sourceport'}, dest => > $config{'targetport'},syn => 1, psh => 1}}); > #$packet->ethnew($config{'device'}); > #$packet->ethset(source => $config{'spoof'}, dest => > $config{'target'});$packet->send(0,$config{'number'}); > > print "\nDone.\n\n"; > > sub readhash > { > my($self,$command,$wert); > my(@config); > my(%parameter); > > $self = $_[0]; > > # Die Konfigurationsdatei wird gelesen > open (CONFIG,"<$self") || die "Kann Configfile $confdata nicht > einlesen!!!\n"; > > while(<CONFIG>) > { > if($_ =~ /^#/) > { > next; > } > elsif(length($_)<2) > { > next; > } > else > { > chomp $_; > ($command,$wert) = split(/\s*==\s*/,$_); > $parameter{$command}=$wert; > } > } > close(CONFIG); > return %parameter; > } > > sub help > { > print "\n\n\t\t\t\t\t\t\t\t\t\t<<<Comp Junx Company>>>\n\n\n"; > print "\n\n\t\t\tIP-Packet.pl -- A TCP packet generator\n"; > print "\t\t\tProgrammed by <<<SyntaX>>>\n\n"; > print "\t\t\tUsage: ./IP-Packet.pl [-c configfile]\n\n"; > > sleep 6; > system("/usr/bin/clear"); > print "\t\t\tCH3CK TH3 PL4N3T\n\n"; > exit(0); > } > > --------- > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]