Ever used nbtscan by Alla Bezroutchko (a pretty good NetBIOS Scanner)??? If you did, you should have realized that copying by hand each IP address, computer name and the #PRE string into lmhosts is a hellish thing, expecially if you did scan a wide range of hosts.
This Perl script works for you, matching the right strings into nbtscan typical output and formatting them in such a way that you just need to cut and paste the whole thing into lmhosts and reload the host table. Then you'll be able to connect remote resources in a snap of your fingers.
enjoy
SiG
P.S.: this is one of my earliest scripts, and I didn't look for elegance! By the way, it works and saved me a lot of work!
#!/usr/bin/perl print ""; print " - Sigmund Baginov NetBIOS2Lmhosts -\n"; print " - The NetBIOS Scan Output Ordinator-\n"; print " -=# Version 1.0 - August 2001 #=-\n"; print " odOOOOboo __.--._\n"; print " oOOOOOOOOOOOO° °,\n"; print " OOOOOOOOOOOOOOO .-°\n"; print " OOOOOOOOOOOOOOOOO .-°\n"; print " OOOOOOOOOOOOOOL.-°\n"; print " .-° OOOOOOOOOT.I°OO\n"; print " .° °OOOL-T°OOOO° \n"; print " °-...--+°°OOOOOOP°°\n"; print "\n"; print "\n"; print "Insert Input File:\n"; $in = <STDIN>; print "Output File? (usually lmhosts)\n"; $out = <STDIN>; open (INF,"< $in"); open (OUF,"> $out"); ######################################## # Definition of strings to match ######################################## $conf = "NetBIOS Name Table for Host "; $conf2 = "<00>"; $conf3 = "UNIQUE"; ################################### # Main loop ################################### while (!eof(INF)) { $line = <INF>; ################################### # Find "NetBIOS Name...etc..." ################################### if ($line =~ /$conf+./) { $line =~ s/$conf//; $line =~ s/\x3A//; chop $line; $line = $line."\t"; print OUF $line; $control = 1; } if ($control == 1) { ########################################## # Find Computer Name ########################################## if ($line =~ /.+$conf2+.+$conf3/) { $line =~ s/$conf2//; $line =~ s/$conf3//; $line =~ s/\W//g; $line = $line."\t"."#PRE"."\n"; print OUF $line; $control = 0; } } } close(INF); close(OUF); print "\n"; print "Done. Control output editing lmhosts.\n"; print "Execute \"nbtstat -R\" to refresh\n";

In reply to NbtScan Output Formatter by Sigmund

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.