⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ip-packet-gui.pl

📁 一个rst守护程序
💻 PL
📖 第 1 页 / 共 2 页
字号:
#!/usr/bin/perl# IP-Packet -- The ultimative Packet Generator written in Perl## The GUI Code################################################################### Last Update 28.11.2002## Programmed by Bastian Ballmann [ bytebeater@crazydj.de ]# http://www.crazydj.de# ## Perl is phun!!! =)## This code is licensed under the GPL###[ Loading Modules ]###use Tk;use Tk::FileSelect;###[ Main Part ]###select_proto();MainLoop();###[ Subroutines ]######[ Create the Main window depending on the selected protocol ]###sub create_win{    $askproto->destroy;###[ Das Hauptfenster ]###$top = MainWindow->new();$top->title('IP-Packet -- A Packetgenerator written in Perl');$top->configure(background => 'black', foreground => 'green');$menu = $top->Menu(type => 'Menubar');$menu->configure(background => 'black');###[ Die Menuleiste ]###$conf = $menu->cascade('-label' => 'Configure');$conf->configure(foreground => 'green',		 background => 'black',		 activebackground => 'black',		 activeforeground => 'red');$conf->command('-label' => 'Select another protocol',	       foreground => 'green',	       background => 'black',	       activebackground => 'black',	       activeforeground => 'red',	       command => \&select_proto);$conf->command('-label' => 'Read Configfile',	        foreground => 'green',	        background => 'black',	       activebackground => 'black',	       activeforeground => 'red',		command => \&opencfgdialog);$conf->command('-label' => 'Save Configuration',	        foreground => 'green',	        background => 'black',	       activebackground => 'black',	       activeforeground => 'red',		command => \&savecfgdialog);$about = $menu->cascade('-label' => 'About');$about->configure(foreground => 'green',		  background => 'black',	          activebackground => 'black',	          activeforeground => 'red');$about->command('-label' => 'About this tool',	         foreground => 'green',		 background => 'black',		activebackground => 'black',		activeforeground => 'red',		 command => \&about);$about->command('-label' => 'Heeelp me',		foreground => 'green',		background => 'black',	       activebackground => 'black',	       activeforeground => 'red',		command => \&help);$top->configure(-menu => $menu);###[ Labels ]###$inhalt = $top->Frame->pack(side => 'top', pady => 25);$inhalt->configure(background => 'black', foreground => 'blue');$label = $inhalt->Label(text => 'IP-Packet -- The ultimative packetgenerator',		     background => 'black',		     foreground => 'green',		     border => 0,		     relief => 'groove',		     anchor => 'n')->pack(-side => 'top');    my $prototmp = uc($config{'protocol'});$protolabel = $inhalt->Label(text => "Create a $prototmp / IP packet",			     background => 'black',			     foreground => 'green',			     border => 0)->pack(pady => 10);    $oben = $inhalt->Frame()->pack(side => 'top');    $oben->configure(background => 'black');    $inhalt1 = $oben->Frame()->pack(side => 'left', pady => 15, padx => 15);    $inhalt1->configure(background => 'black');    $inhalt2 = $oben->Frame()->pack(side => 'right', pady => 15, padx => 15);    $inhalt2->configure(background => 'black');###[ IP Options ]###my $slabel = $inhalt1->Label(text => 'Source IP: ',			      background => 'black',			      foreground => 'green',			      border => 0)->pack(-side => 'top', pady => 5);$spoof = $inhalt2->Entry(background => 'black',			 foreground => 'green')->pack(side => 'top', pady => 2);my $dlabel = $inhalt1->Label(text => 'Destination IP: ',			      background => 'black',			      foreground => 'green',			      border => 0)->pack(-side => 'top', pady => 5);    $tentry = $inhalt2->Entry(background => 'black',			      foreground => 'green')->pack(-side => 'top', pady => 2);my $fraglabel = $inhalt1->Label(text => 'Fragmentation Offset: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $fragentry = $inhalt2->Entry(background => 'black',				foreground => 'green')->pack(side => 'top', pady => 2);my $ttllabel = $inhalt1->Label(text => 'Time to live: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $ttlentry = $inhalt2->Entry(background => 'black',				foreground => 'green')->pack(side => 'top', pady => 2);###[ ICMP Options ]###if($config{'protocol'} eq "icmp"){$icmptypelabel = $inhalt1->Label(text => 'ICMP-Type: ',	       		    background => 'black',	       		    foreground => 'green',	       		    border => 0)->pack(side => 'top', pady => 2);$icmptypeentry = $inhalt2->Entry(background => 'black',				 foreground => 'green')->pack(side => 'top', pady => 2);$icmpcodelabel = $inhalt1->Label(text => 'ICMP-Code: ',	       		    background => 'black',	       		    foreground => 'green',	       		    border => 0)->pack(side => 'top', pady => 2);$icmpcodeentry = $inhalt2->Entry(background => 'black',				 foreground => 'green')->pack(side => 'top', pady => 2);$gatewaylabel = $inhalt1->Label(text => 'Gateway: ',	       		    background => 'black',	       		    foreground => 'green',	       		    border => 0)->pack(side => 'top', pady => 2);$gatewayentry = $inhalt2->Entry(background => 'black',				 foreground => 'green')->pack(side => 'top', pady => 2);$mtulabel = $inhalt1->Label(text => 'MTU: ',	       		    background => 'black',	       		    foreground => 'green',	       		    border => 0)->pack(side => 'top', pady => 2);$mtuentry = $inhalt2->Entry(background => 'black',				 foreground => 'green')->pack(side => 'top', pady => 2);}###[ TCP / UDP Options ]###else{my $sportlabel = $inhalt1->Label(text => 'Sourceport: ',			      background => 'black',			      foreground => 'green',			      border => 0)->pack(side => 'top', pady => 5);    $sportentry = $inhalt2->Entry(background => 'black',				  foreground => 'green')->pack(side => 'top', pady => 2);my $dportlabel = $inhalt1->Label(text => 'Destinationport: ',			      background => 'black',			      foreground => 'green',			      border => 0)->pack(side => 'top', pady => 5);    $dportentry = $inhalt2->Entry(background => 'black',				  foreground => 'green')->pack(side => 'top', pady => 2);###[ TCP only Options ]###if($config{'protocol'} eq "tcp"){my $seqnumlabel = $inhalt1->Label(text => 'Sequence number: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $seqnumentry = $inhalt2->Entry(background => 'black',				   foreground => 'green')->pack(side => 'top', pady => 2);my $acknumlabel = $inhalt1->Label(text => 'Acknowledgement number: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $acknumentry = $inhalt2->Entry(background => 'black',				   foreground => 'green')->pack(side => 'top', pady => 2);my $winlabel = $inhalt1->Label(text => 'Window size: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $winentry = $inhalt2->Entry(background => 'black',				foreground => 'green')->pack(side => 'top', pady => 2);    $inhalt3 = $inhalt->Frame()->pack(side => 'top', pady => 5);    $inhalt3->configure(background => 'black');my $flaglabel = $inhalt3->Label(text => 'Now select the TCP flags: ',				 background => 'black',				 foreground => 'green',				 border => 0)->pack(pady => 10);# Default maessig sind alle flags aus$config{'syn'} = 0;$config{'ack'} = 0;$config{'rst'} = 0;$config{'fin'} = 0;$config{'psh'} = 0;$config{'urg'} = 0;$syn = $inhalt3->Checkbutton(variable => \$config{'syn'},			       text => 'SYN',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');$ack = $inhalt3->Checkbutton(variable => \$config{'ack'},			       text => 'ACK',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');$fin = $inhalt3->Checkbutton(variable => \$config{'fin'},			       text => 'FIN',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');$rst = $inhalt3->Checkbutton(variable => \$config{'rst'},			       text => 'RST',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');$psh = $inhalt3->Checkbutton(variable => \$config{'psh'},			       text => 'PSH',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');$urg = $inhalt3->Checkbutton(variable => \$config{'urg'},			       text => 'URG',			       onvalue => 1,			       offvalue => 0,			       activebackground => 'black',			       activeforeground => 'red',			       background => 'black',			       foreground => 'green')->pack(side => 'left');}}###[ General Options ]###my $datalabel = $inhalt1->Label(text => 'Packet data: ',				background => 'black',				foreground => 'green',				border => 0)->pack(side => 'top', pady => 5);    $dataentry = $inhalt2->Entry(background => 'black',				 foreground => 'green')->pack(side => 'top', pady => 2);my $numberlabel = $inhalt1->Label(text => 'How many packets shall I send? :  ',			      background => 'black',			      foreground => 'green',			      border => 0)->pack(side => 'top', pady => 5);    $nentry = $inhalt2->Entry(background => 'black',			      foreground =>'green')->pack(side => 'top', pady => 2);###[ The Taskbar ]###$taskbar = $top->Frame()->pack(-side => 'bottom');$taskbar->configure(background => 'black');$run = $taskbar->Button(text => 'Run Packet! Run!!',			background => 'black',			foreground => 'green',			activebackground => 'black',			activeforeground => 'red',			borderwidth => 0,			border => 0,			command => \&cfgstart)->pack(side => 'left', padx => 25);$quit = $taskbar->Button(text => 'Quit that shit',			 background => 'black',			 foreground => 'green',			 activebackground => 'black',			 activeforeground => 'red',			 borderwidth => 0,			 border => 0,			 command => \&exitme)->pack(side => 'right', padx => 25);}###[ End of Mainwindow creation ]####################################[ The dialogs ]#################################[ Select the protocol ]###sub select_proto{# Falls die Routine nicht zum ersten Mal aufgerufen wurde,# muss das Hauptfenster geloescht werdenif($top){    $top->destroy;}$askproto = new MainWindow;$askproto->title('Give me a protocol');$askproto->configure(background => 'black', foreground => 'green', width => 300, height => 200);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -