📄 ip-packet-gui.pl
字号:
$askproto->Label(text => 'Select a protocol', background => 'black', foreground => 'green', border => 0)->pack(side => 'top', pady => 10);$oben = $askproto->Frame->pack(side => 'top', pady => 5);$unten = $askproto->Frame->pack(side => 'bottom', pady => 5);$oben->configure(background => 'black');$unten->configure(background => 'black');# Standard Protocol ist TCP$config{'protocol'} = "tcp";$tcp = $oben->Radiobutton(variable => \$config{'protocol'}, text => 'TCP', value => 'tcp', activebackground => 'black', activeforeground => 'red', background => 'black', foreground => 'green')->pack(side => 'left', pady => 5, padx => 5);$udp = $oben->Radiobutton(variable => \$config{'protocol'}, text => 'UDP', value => 'udp', activebackground => 'black', activeforeground => 'red', background => 'black', foreground => 'green')->pack(side => 'left', pady => 5, padx => 5);$icmp = $oben->Radiobutton(variable => \$config{'protocol'}, text => 'ICMP', value => 'icmp', activebackground => 'black', activeforeground => 'red', background => 'black', foreground => 'green')->pack(side => 'right', pady => 5, padx => 5);$submit = $unten->Button(text => 'OK', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', borderwidth => 0, border => 0, command => \&create_win)->pack(pady => 5);}###[ Help Dialog ]###sub help{ $helpwin = $top->Toplevel; $helpwin->title('Dont got r00t?? :-p'); $helpwin->configure(foreground => 'red', background => 'black'); $help1 = $helpwin->Label(text => 'If you need help, please read the documents located in docs', background => 'black', foreground => 'red', border => 0)->pack(pady => 5); $suckdown = $helpwin->Frame()->pack(pady => 20);$scriptkiddie = $suckdown->Button(text => 'Close', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', borderwidth => 5, command => sub { destroy $helpwin })->pack();}###[ Load a config file ]###sub opencfgdialog{my $f = $top->FileSelect(-directory => ".", -filter => "*");$cfgfile = $f->Show();$oldprotocol = $config{'protocol'};%config = config::readcfg("h",$cfgfile);&showconfig();}###[ Save Configuration to file ]###sub savecfgdialog{&readcfg();my $f = $top->FileSelect(-directory => ".", -filter => "*");my $cfgfile = $f->Show();open(CFG,">$cfgfile") || print STDERR "Cannot write to $cfgfile!\n$!\n\n"; while(($key,$value) = each %config) { print CFG "$key == $value\n"; }close(CFG);} ###[ Ein About Dialog ]###sub about{ $aboutwin = $top->Toplevel; $aboutwin->title('About this nice tool'); $aboutwin->configure(background => 'black', foreground => 'red'); $info = $aboutwin->Label(text => 'IP-Packet -- An advanced packetgenerator written in Perl', background => 'black', foreground => 'red', border => 0)->pack(pady => 5); $info2 = $aboutwin->Label(text => 'Programmed by Bastian Ballmann', background => 'black', foreground => 'red', border => 0)->pack(padx => 10); $info4 = $aboutwin->Label(text => 'Last Update 28.11.2002', background => 'black', foreground => 'red', border => 0)->pack(pady => 5); $downtown = $aboutwin->Frame()->pack(pady => 20);$closebtn = $downtown->Button(text => 'Just close it!', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', borderwidth => 5, command => sub { destroy $aboutwin})->pack();}###[ Quit that shit =) ]###sub exitme {$exit = $top->Toplevel;exit(0);}#######################[ Configuration Part ]####################################[ Read config and start sending the packet(s) ]###sub cfgstart{ &readcfg(); &run();}###[ Reading the users input ]###sub readcfg{ $tmp1 = $spoof->get; $config{'spoof'} = $tmp1; $tmp2 = $tentry->get; $config{'target'} = $tmp2; if($config{'protocol'} eq "icmp") { $tmp3 = $icmptypeentry->get; $config{'icmp-type'} = $tmp3; $tmp4 = $icmpcodeentry->get; $config{'icmp-code'} = $tmp4; $mtutmp = $mtuentry->get; $config{'mtu'} = $mtutmp; $gatewaytmp = $gatewayentry->get; $config{'gateway'} = $gatewaytmp; } else { $tmp3 = $sportentry->get; $config{'src_port'} = $tmp3; $tmp4 = $dportentry->get; $config{'dst_port'} = $tmp4; if($config{'protocol'} eq "tcp") { $tmp5 = $seqnumentry->get; $config{'seq'} = $tmp5; $tmp6 = $acknumentry->get; $config{'ack_seq'} = $tmp6; $tmp7 = $winentry->get; if($tmp7 eq "") { $tmp7 = "1000"; } $config{'win'} = $tmp7; } } $fragtmp = $fragentry->get; $config{'frag'} = $fragtmp; $ttltmp = $ttlentry->get; if($ttltmp eq "") { $ttltmp = "120"; } $config{'ttl'} = $ttltmp; $tmp8 = $dataentry->get; $config{'data'} = $tmp8; $tmp9 = $nentry->get; $config{'number'} = $tmp9;}###[ Print the Configuration on the main window ]###sub showconfig{# No protocol at all? unless(exists $config{'protocol'}) { $error = $top->Toplevel; $error->configure(background => 'black'); $error->Label(text => "The configuration contains no protocol!", background => 'black', foreground => 'green', border => 0)->pack(side => 'top', pady => 5, padx => 10); $error->Button(text => 'OK', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', command => sub { $error->destroy })->pack(side => 'bottom', pady => 5, padx => 10); $config{'protocol'} = $oldprotocol; return; } elsif($config{'protocol'} eq "") { $error = $top->Toplevel; $error->configure(background => 'black'); $error->Label(text => "The configuration contains no protocol!", background => 'black', foreground => 'green', border => 0)->pack(side => 'top', pady => 5, padx => 10); $error->Button(text => 'OK', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', command => sub { $error->destroy })->pack(side => 'bottom', pady => 5, padx => 10); $config{'protocol'} = $oldprotocol; return; }# Protoocol has changed? elsif($oldprotocol ne $config{'protocol'}) { $error = $top->Toplevel; $error->configure(background => 'black'); $error->Label(text => "The configuration file contains the wrong protocol!", background => 'black', foreground => 'green', border => 0)->pack(side => 'top', pady => 5, padx => 10); $error->Button(text => 'OK', background => 'black', foreground => 'green', activebackground => 'black', activeforeground => 'red', command => sub { $error->destroy })->pack(side => 'bottom', pady => 5, padx => 10); $config{'protocol'} = $oldprotocol; return; } $spoof->delete(0,end); $spoof->insert('0',"$config{'spoof'}"); $tentry->delete(0,end); $tentry->insert('0',"$config{'target'}"); $fragentry->delete(0,end); $fragentry->insert('0',"$config{'frag'}"); $ttlentry->delete(0,end); $ttlentry->insert('0',"$config{'ttl'}"); if($config{'protocol'} eq "icmp") { $icmptypeentry->delete(0,end); $icmptypeentry->insert('0',"$config{'icmp-type'}"); $icmpcodeentry->delete(0,end); $icmpcodeentry->insert('0',"$config{'icmp-code'}"); $gatewayentry->delete(0,end); $gatewayentry->insert('0',"$config{'gateway'}"); $mtuentry->delete(0,end); $mtuentry->insert('0',"$config{'mtu'}"); } else { $sportentry->delete(0,end); $sportentry->insert('0',"$config{'src_port'}"); $dportentry->delete(0,end); $dportentry->insert('0',"$config{'dst_port'}"); if($config{'protocol'} eq "tcp") { $seqnumentry->delete(0,end); $seqnumentry->insert('0',"$config{'seq'}"); $acknumentry->delete(0,end); $acknumentry->insert('0',"$config{'ack_seq'}"); $winentry->delete(0,end); $winentry->insert('0',"$config{'win'}"); $syn->deselect(); $ack->deselect(); $psh->deselect(); $fin->deselect(); $rst->deselect(); $urg->deselect(); if($config{'syn'}) { $syn->select(); } if($config{'ack'}) { $ack->select(); } if($config{'psh'}) { $psh->select(); } if($config{'rst'}) { $rst->select(); } if($config{'fin'}) { $fin->select(); } if($config{'urg'}) { $urg->select(); } } } $dataentry->delete(0,end); $dataentry->insert('0',"$config{'data'}"); $nentry->delete(0,end); $nentry->insert('0',"$config{'number'}"); $top->update();}1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -