UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
December
Su M Tu W Th F Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Sponsored Links
Latest Postings
Latest Reviews
Topic Options
Rate This Topic
#2327 - 12/02/03 12:28 AM GLIPER - Grepable Logifile IP ExtractoR
? Offline
UGN Member

Registered: 04/30/02
Posts: 135
nmap has this cool random search option that lets you scan random IP numbers. It can come if very handy if you are looking for a certain service or someplace to try out a new exploit.

nmap -sS -iR 0 -p 21

this will randomly search for FTP servers. Now, you are going to get a lot of servers that have the port closed or filtered and it's a pain in the ass going through the output looking for an open server. If you add the -oG option you can save the output to a grepable file but you still get all the closed hosts . This is where GLIPER comes in. you feed it a nmap logfile and it spits out a file of only the IP addresses which have the port open, which then can be used for further testing with tools like nessus etc. when you issue the nmap command jus specify a logfile and run it through GLIPER and you save yourself a whole lotta time.

nmap -sS -iR 0 -p 21 -oG logfile

I realize this will make a lot of script kiddies happy but hey, I needed somethin like this for myself and why not share it with the rest of the world. Here's the source, it's in Perl. Do what you want with it..


------------------cut ----------------------

#!/usr/bin/perl -w
#hope you like all the comments
#even your grand mother could make sense of this code


print "*************************************************\n";
print "\t\tGliper (v 0.1)\n";
print "Extracts IP addresses from Nmap grepable logfiles\n";
print "Issue nmap command with '-oG' option\n";
print "by: Damien (damienak1\@hotmail.com)\n";
print "*************************************************\n\n";


#open nmap logfile
print "Enter name of logfile: ";
chomp($logfile = );
open(LOG, $logfile) || die;

#open a file for output
print "Enter name of output file: ";
chomp($output = );
open(OUTPUT, ">$output");

#array of lines from logfile
@lines = ;

#go through array looking for strings matching the regular expressions
foreach(@lines){
if (/Host: / && /open/){ #only lines starting with Host: that have an open port
s/Host:(\s)//; #delete the Host: string
s/(\s).{1,100}//; #delete anythin after white-space
print OUTPUT; #print IP address to the output file
}
}

#close both file-handles
close(OUTPUT);
close(LOG);


-----------------------------cut--------------------------------

p.s. I wasn't sure where to post this. we don't have a perl forum, perl and nmap are available on linux and windows, and the other programming section is about website programming, and this isn't. so if it's in the wrong forum somebody can move it.
_________________________
I KNOW EVERYTHING. ASK ME.

Top
Sponsored Links
      
#2328 - 12/02/03 12:56 AM Re: GLIPER - Grepable Logifile IP ExtractoR
Infinite Offline



Registered: 03/09/02
Posts: 1041
Loc: Canada eh
Technically Perl is lumped in with the webdesign forum (see description). I don't really like that just cause I use Perl and it has nothing to do with webdesign

Nice little util though dak. But why not just 'cat logfile | grep open' ?

Infinite

Top
#2329 - 12/02/03 01:15 AM Re: GLIPER - Grepable Logifile IP ExtractoR
? Offline
UGN Member

Registered: 04/30/02
Posts: 135
well, let say you want to to get a list of ftp servers and them run them through nessus. nessus (or any other program) doesn't understand all the other shit thats on the line. or if some evil hacker wanted to launch a worm, he could have this as part of his payload to make the hacked servers scan for more servers with the same service running an then try to exploit each one in the list,. there a bunch of application for this, none of them good. at least none that i can figure out. but hey, i wrote this while i was learning perl an it turned out kinda cool, so thats reason enough.
_________________________
I KNOW EVERYTHING. ASK ME.

Top
#2330 - 12/04/03 01:46 AM Re: GLIPER - Grepable Logifile IP ExtractoR
Gollum Offline
Member

Registered: 06/05/02
Posts: 207
Loc: US
wouldn't this work? then just open up the "newlogfile" in nessus.
cat logfile | grep open > newlogfile
anyway, i realize you probably wrote this partly b/c you wanted to try out some perl scripting stuff, which is cool, so even if there is a simpler way, at least you learned something and made something you're proud of.
//
_________________________
Unbodied unsouled unheard unseen
Let the gift be grown in the time to call our own
Truth is natural like a wind that blows
Follow the direction no matter where it goes
Let the truth blow like a hurricane through me

Top
#2331 - 12/09/03 09:23 PM Re: GLIPER - Grepable Logifile IP ExtractoR
david_isis Offline
Junior Member

Registered: 12/04/03
Posts: 18
if you found that tool usefull then go to happy hacker.org
_________________________
This user is a complete and total dipshit and has been banned from the BBS. We're sorry for the inconveniance. - Gizmo

Top
#2332 - 12/10/03 01:35 AM Re: GLIPER - Grepable Logifile IP ExtractoR
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
It's the Web Design & Protocols forum... Mainly because they were the only two close enough to combine...
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#2333 - 02/01/04 11:32 PM Re: GLIPER - Grepable Logifile IP ExtractoR
Gollum Offline
Member

Registered: 06/05/02
Posts: 207
Loc: US
oh wow, i was just going over some older posts, and i realized how wrong i was, lol. sorry, i completely missed your point. but i did find out, the correct string of commands would be:

cat nmaplog.log | grep "open" | cut -d " " -f 2 > newlogfile

not that it matters much, but i just wanted to correct myself.//
_________________________
Unbodied unsouled unheard unseen
Let the gift be grown in the time to call our own
Truth is natural like a wind that blows
Follow the direction no matter where it goes
Let the truth blow like a hurricane through me

Top

Moderator:  Infinite 
Featured Member
Registered: 08/22/14
Posts: 1
Forum Stats
2152 Members
46 Forums
36195 Topics
71365 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 29356
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
cdefgh368568, HushHush, golqm, Tim050, Gecko666
2151 Registered Users
Who's Online
0 registered (), 392 Guests and 342 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!