MCPcopy
hub / github.com/r0ysue/r0capture / ipToNumber

Function ipToNumber

script.js:90–105  ·  view source on GitHub ↗
(ip)

Source from the content-addressed store, hash-verified

88initializeGlobals();
89
90function ipToNumber(ip) {
91 var num = 0;
92 if (ip == "") {
93 return num;
94 }
95 var aNum = ip.split(".");
96 if (aNum.length != 4) {
97 return num;
98 }
99 num += parseInt(aNum[0]) << 0;
100 num += parseInt(aNum[1]) << 8;
101 num += parseInt(aNum[2]) << 16;
102 num += parseInt(aNum[3]) << 24;
103 num = num >>> 0;//这个很关键,不然可能会出现负数的情况
104 return num;
105}
106
107/**
108 * Returns a dictionary of a sockfd's "src_addr", "src_port", "dst_addr", and

Callers 2

getPortsAndAddressesFunction · 0.85
script.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected