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

Function convert_ipv4_to_B

utils.py:105–123  ·  view source on GitHub ↗
(view)

Source from the content-addressed store, hash-verified

103
104
105def convert_ipv4_to_B(view):
106 rets = {}
107 pattern = r'\d{1,3}\.\d{1,3}\.'
108 regions = view.find_all(pattern)
109
110 for region in regions:
111 ip = view.substr(region).strip('.')
112 if ip in rets.keys():
113 rets[ip] = rets[ip] + 1
114 else:
115 rets[ip] = 1
116
117 rets = sorted(rets.items(), key=lambda v:v[1], reverse = True)
118
119 text = '[+] 所有 B 段: \n'
120 for line in rets:
121 text += '{0}.0.0/16 [{1}]'.format(line[0],line[1]) + "\n"
122
123 return text
124
125
126def select_ipv4(view):

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected