Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

换行符导致程序报错 更换以下代码 程序将运行没有错误 #3

Open
hjk33433 opened this issue Nov 6, 2023 · 0 comments

Comments

@hjk33433
Copy link

hjk33433 commented Nov 6, 2023

with open(masscan_file, 'r') as fr:
tmp_lines = fr.readlines()
lines = tmp_lines[1:-1]
global total_ports
total_ports = len(lines)
lines = lines[::2]
lines2 = []
for i, item in enumerate(lines):
processed_item = item.replace("\n", "")
lines2.append(processed_item)
for line in lines2:
line_json = json.loads(line)
# print(line_json)
# extract ip & port
ip = line_json['ip']
port = line_json['ports'][0]['port']
# combine ip:port, and add to queue
ip_port = '{}:{}'.format(ip, port)
task_queue.put(ip_port)
print(ip_port+'\n')
# exit()
pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant