I wished to create a tab frame under a menu system. The menu system would create tabs as users began jobs and then push external program output to the tab as the job runs in background. It will also be saving much of the output to database for querying later.

I have a bit of perl experience, but am not neat or as efficient as many others (self taught) so sorry or any non-perfect code you might find. Also I've worked on this maybe 10 hours and much of it isn't written as I seem to be stuck at the point where I am trying to create a tab from the menu selection.

I will be putting the propper module headers and such in later (I was testing the implementation of modules when I was doing this for instance). So, once again not much point digressing to "OMG, You aren't using strict?!?!" etc..

Thanks a lot,
Peter.

console.pl starts here:

#!/usr/bin/perl use Tk; use Tk::LabFrame; use Tk::NoteBook; my $Version = "1.0"; sub mainmenu { $main = MainWindow->new(); $main->minsize( qw(640 480)); $main->title( "Rasputin"); $main->configure(-background => 'black'); $menu_bar = $main->Frame(-relief => 'groove', -borderwidth=> 3, -background=> 'black')->pack(-side =>top, -fill +=> 'x', -anchor=>'n'); $scan_menu=$menu_bar->Menubutton(-text => 'Scans', -background => 'black', -foreground => '#00ff00', -activebackground => '#00ff00', -activeforeground => 'black')->pack(-side => 'left'); $bruteforce_menu=$menu_bar->Menubutton(-text => 'Bruteforce', -background => 'black', -foreground => '#00ff00', -activebackground => '#00ff00', -activeforeground => 'black')->pack(-side => 'left'); $search_menu=$menu_bar->Menubutton(-text => 'Searches', -background => 'black', -foreground => '#00FF00', -activebackground => '#00ff00', -activeforeground => 'black')->pack(-side => 'left'); $configuration_menu=$menu_bar->Menubutton(-text => 'Configuration' +, -background => 'black', -foreground => '#00ff00', -activebackground => '#00ff00', -activeforeground => 'black')->pack(-side => 'left'); $help_menu=$menu_bar->Menubutton(-text => 'Help', -background => 'black', -foreground => '#00ff00', -activebackground => '#00ff00', -activeforeground => 'black')->pack(-side => 'right'); $tab_dialog=$main->Frame(-background=> 'black', -relief => 'groove +', -borderwidth=> '3', -foreground => '#00ff00')->pack(-side=> 'bottom', -fill => 'both') +; $tab_dialog->pack(); $tabsinside=$tab_dialog->NoteBook(); $tabsinside->pack(-fill => 'x'); } sub startup { load_modules(); } sub load_modules { foreach $module (<*.module.pl>) { require "$module"; push (@modules_loaded, $module); } } mainmenu(); startup(); MainLoop();

And now nmap.module.pl:

sub begin_menus{ $scan_menu->command(-label => 'Nmap Scan', -background=>'black', -foreground=>'#00ff00', -activebackground=>'#00ff00', -activeforeground=>'black', -command => sub { &nmap_scan_dialog() } ); $search_menu->command(-label => 'Nmap Database Search', -background =>'black', -foreground =>'#00ff00', -activebackground=>'#00ff00', -activeforeground=>'black', -command => sub { &nmap_search_dialog() } ); $configuration_menu->command(-label => 'Nmap Configuration', -background=>'black', -foreground=>'#00ff00', -activebackground=>'#00ff00', -activeforeground=>'black', -command => sub { &nmap_configuration_dialog() } ); } sub nmap_search_dialog { return 1; } sub nmap_scan_dialog { $tabsinside->add("nmap", -label => "Nmap Scan")->pack(); } sub nmap_configuration_dialog { return 1; } sub nmap_start { if ( begin_menus() ) { return 1; } } nmap_start();


In reply to Tk::NoteBook issue with creating tabs under a menu by thefinn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.