From 0a4b66de799d0387df5e6e242be3b26574f8a082 Mon Sep 17 00:00:00 2001 From: maldevel Date: Tue, 15 Dec 2015 12:56:10 +0200 Subject: [PATCH] readme readme --- README.md | 25 +++++++++++++++++++------ ip2geolocation.py | 8 ++++---- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d89b2fd..c40958c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Python 3.x * Pick a random User Agent string from a list in file (Every User Agent string in new line). * Call program with no arguments to get your ip geolocation. * Open IP geolocation in google maps using the default browser. +* Export results to csv, xml and txt format. **Geolocation Information** @@ -41,10 +42,10 @@ Python 3.x ``` $ ./ip2geolocation.py -h usage: ip2geolocation.py [-h] [-t Host] [-u User-Agent] [-r] - [-l User-Agent list] [-x Proxy] [-g] + [-l User-Agent list] [-x Proxy] [-g] [--csv file] + [--xml file] [-e file] - -IPGeoLocation 1.3 +IPGeoLocation 1.4 A tool to retrieve IP Geolocation information. Powered by http://ip-api.com @@ -54,12 +55,15 @@ optional arguments: -t Host, --target Host The IP Address or Domain to be analyzed. -u User-Agent, --useragent User-Agent - Set the User-Agent request header (default: IP2GeoLocation). + Set the User-Agent request header (default: IP2GeoLocation 1.4). -r Pick User Agent strings randomly. - -l User-Agent list Set tge User-Agent file list. Each User-Agent string should be in a new line. + -l User-Agent list A User-Agent list file. Each User-Agent string should be in a new line. -x Proxy, --proxy Proxy - Set the proxy server (example: http://127.0.0.1:8080). + Setup proxy server (example: http://127.0.0.1:8080). -g Open IP location in Google maps with default browser. + --csv file File to export results in CSV format. + --xml file File to export results in XML format. + -e file, --txt file File to export results. ``` @@ -82,3 +86,12 @@ optional arguments: **Retrieve IP geolocation and open location in Google maps with default browser** * ./ip2geolocation.py -t x.x.x.x -g + +**Export results to CSV file** +* ./ip2geolocation.py -t x.x.x.x --csv /path/to/file.csv + +**Export results to XML file** +* ./ip2geolocation.py -t x.x.x.x --xml /path/to/file.xml + +**Export results to TXT file** +* ./ip2geolocation.py -t x.x.x.x -e /path/to/file.txt diff --git a/ip2geolocation.py b/ip2geolocation.py index bced03b..b80d193 100644 --- a/ip2geolocation.py +++ b/ip2geolocation.py @@ -72,12 +72,12 @@ def checkFileWrite(filename): parser.add_argument('-t', '--target', metavar='Host', help='The IP Address or Domain to be analyzed.') parser.add_argument('-u', '--useragent', metavar='User-Agent', default='IP2GeoLocation {}'.format(VERSION), help='Set the User-Agent request header (default: IP2GeoLocation {}).'.format(VERSION)) parser.add_argument('-r', help='Pick User Agent strings randomly.', action='store_true') - parser.add_argument('-l', metavar='User-Agent list', type=checkFileRead, dest='user_agent_list', help='Please provide a User-Agent file list. Each User-Agent string should be in a new line.') + parser.add_argument('-l', metavar='User-Agent list', type=checkFileRead, dest='user_agent_list', help='A User-Agent list file. Each User-Agent string should be in a new line.') parser.add_argument('-x', '--proxy', metavar='Proxy', type=checkProxy, help='Setup proxy server (example: http://127.0.0.1:8080).') parser.add_argument('-g', help='Open IP location in Google maps with default browser.', action='store_true') - parser.add_argument('--csv', metavar='Filename', type=checkFileWrite, help='Please provide a file to export results in CSV format.') - parser.add_argument('--xml', metavar='Filename', type=checkFileWrite, help='Please provide a file to export results in XML format.') - parser.add_argument('-e', '--txt', metavar='Filename', type=checkFileWrite, help='Please provide a file to export results.') + parser.add_argument('--csv', metavar='file', type=checkFileWrite, help='File to export results in CSV format.') + parser.add_argument('--xml', metavar='file', type=checkFileWrite, help='File to export results in XML format.') + parser.add_argument('-e', '--txt', metavar='file', type=checkFileWrite, help='File to export results.') args = parser.parse_args()