python 处理wydomain域名

在信息收集时,用到两个工具,一个是猪猪侠的wydomain,一个是lijiejie的BBScan.
希望将wydomain得到的域名结果,处理成一行一个,这样方便用BBScan批量扫描敏感信息泄露.于是写个脚本,顺便练习一下python.

1
python sortout.py target.txt
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
#! /usr/bin/env python
# coding=utf-8
#
#Useage:
#python sortout.py target.txt
#
import sys

def sortout(filepath):
f=open(filepath,'r')
lines=f.readlines()
f.close()
file=open(filepath,'w')
for line in lines:
sts=''
line=line.strip()
for char in line:
char=char.replace('"','').replace(',','').replace('[','').replace(']','')
sts=sts+char
if len(sts)!=0:
print(sts)
file.write(sts)
file.write('n')
file.close

if __name__=='__main__':
if len(sys.argv)==1:
print u"必须输入文件路径"
else:
sortout(sys.argv[1])