forked from cloudipsp/all_banks_ips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_ips_plain.py
30 lines (25 loc) · 883 Bytes
/
get_ips_plain.py
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
import socket
import csv
import sys
import argparse
import os
import get_ips
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process some contiries.')
parser.add_argument('--country', metavar='', type=str, nargs='+', help='contiries (default: all)')
parser.add_argument('--file', help='file to write (default: stdout)')
args = parser.parse_args()
if args.file:
out = open(args.file,'w')
else:
out = sys.stdout
filename = 'acs_url.csv'
with open(filename, 'rb') as csvFile:
reader = csv.reader(csvFile, delimiter=',', quotechar='"')
if args.country:
reader = filter( lambda x: x[2] in args.country, reader)
for row in reader:
ret = get_ips.get_ips(row)
out.writelines([ip + os.linesep for ip in ret[3]])
if args.file:
out.close()