MCPcopy
hub / github.com/0dayCTF/reverse-shell-generator / toBytes

Function toBytes

js/script.js:129–148  ·  view source on GitHub ↗
(ip, port)

Source from the content-addressed store, hash-verified

127};
128
129const toBytes = function (ip, port) {
130
131 if (ip.split('.').length == 4) {
132 ip = ip.split('.').map(x => {
133 let octet = parseInt(x);
134 if (!isNaN(octet) && ((octet >= 0) && (octet <= 0xFF)))
135 return `\\x${octet.toString(16).padStart(2, 0)}`;
136 return "\\x..";
137 }).join('');
138 }
139 else ip = "\\x..\\x..\\x..\\x..";
140
141 if (!isNaN(port = parseInt(port))) {
142 port = port.toString(16).padStart(4, 0);
143 port = port.match(/.{2}/g).map(b => `\\x${b}`).join('');
144 }
145 else port = "\\x..\\x..";
146
147 return {ip, port};
148}
149
150const rsg = {
151 ip: (query.get('ip') || localStorage.getItem('ip') || '10.10.10.10').replace(/[^a-zA-Z0-9.\-]/g, ''),

Callers 1

script.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected