MCPcopy Create free account
hub / github.com/chasingboy/Xtools / convert_ipv4_to_C

Function convert_ipv4_to_C

utils.py:46–64  ·  view source on GitHub ↗
(view)

Source from the content-addressed store, hash-verified

44### --- END ---
45
46def convert_ipv4_to_C(view):
47 rets = {}
48 pattern = r'\d{1,3}\.\d{1,3}\.\d{1,3}'
49 regions = view.find_all(pattern)
50
51 for region in regions:
52 ip = view.substr(region)
53 if ip in rets.keys():
54 rets[ip] = rets[ip] + 1
55 else:
56 rets[ip] = 1
57
58 rets = sorted(rets.items(), key=lambda v:v[1], reverse = True)
59
60 text = '[+] 所有 C 段: \n'
61 for line in rets:
62 text += '{0}.0/24 [{1}]'.format(line[0],line[1]) + "\n"
63
64 return text
65
66
67def convert_C_to_ipv4(view):

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected