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

Microsecond Preservation #16

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ hepgen.js -s 127.0.0.1 -p 9063 -P "./path/to/SIP.pcap-txt"
```
hepgen.js -d
```

### Loop a Call multiple times (Be careful how you use it)
```
hepgen.js -s 127.0.0.1 -p 9060 -c "./config/loop_simple.js" --loop 5 //loop same call 5 times
```
143 changes: 143 additions & 0 deletions config/loop_random_src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/* HEPGEN Autogenerated from file => pcap2021-08-17T16 22 30.428Z.txt */

var randomByte = function() {
return Math.round(Math.random()*254);
}


var randomIp = function() {
var ip = randomByte() +'.' +
randomByte() +'.' +
randomByte() +'.' +
randomByte();
if (isPrivate(ip)) return randomIp();
return ip;
}

var isPrivate = function(ip) {
return /^10\.|^192\.168\.|^172\.16\.|^172\.17\.|^172\.18\.|^172\.19\.|^172\.20\.|^172\.21\.|^172\.22\.|^172\.23\.|^172\.24\.|^172\.25\.|^172\.26\.|^172\.27\.|^172\.28\.|^172\.29\.|^172\.30\.|^172\.31\./.test(ip);
}

var srcIp = randomIp();

var callId = Math.random().toString(36).substring(7) + '@127.0.0.1';


var config = {
NAME:"HEPGEN Simple Call 1 Leg for Looping",
HEP_SERVER:"127.0.0.1",
HEP_PORT:9060,
HEP_ID:"2001",
HEP_AUTH:"myHep",
MESSAGES: [
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:srcIp,
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"INVITE sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nContact: <sip:405@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nAllow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS\r\nSupported: replaces, 100rel, timer, norefersub\r\nSession-Expires: 1800\r\nMin-SE: 90\r\nUser-Agent: Hepgen/123\r\nContent-Type: application/sdp\r\nContent-Length: 319\r\n\r\nv=0\r\no=- 3837167151 3837167151 IN IP4 192.168.153.1\r\ns=HepGen 127.0.0.1\r\nb=AS:84\r\nt=0 0\r\na=X-nat:0\r\nm=audio 4000 RTP/AVP 8 101\r\nc=IN IP4 192.168.153.1\r\nb=TIAS:64000\r\na=rtcp:4001 IN IP4 192.168.153.1\r\na=sendrecv\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 telephone-event/8000\r\na=fmtp:101 0-16\r\na=ssrc:1889210388 cname:1a107f3e441a1640\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:srcIp,
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 100 Trying\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nServer: Hepgen Fake 123\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\nSupported: replaces, timer\r\nSession-Expires: 1800;refresher=uas\r\nContact: <sip:405@sip.botauro.com>\r\nContent-Length: 319\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:srcIp,
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nServer: Hepgen Fake 123\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\nSupported: replaces, timer\r\nSession-Expires: 1800;refresh=uas\r\nContact: <sip:405@sip.botauro.com>\r\nRequire: timer\r\nContent-Type: application/sdp\r\nContent-Length: 254\r\n\r\nv=0\r\no=root 1850387284 1850387284 IN IP4 169.141.53.213\r\ns=Asterisk PBX 16.17.0.1\r\nc=IN IP4 169.141.53.213\r\nt=0 0\r\nm=audio 16110 RTP/AVP 8 101\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 telephone-event/8000\r\na=fmtp:101 0-16\r\na=ptime:20\r\na=maxptime:150\r\na=sendrecv\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:srcIp,
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"ACK sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nContact: <sip:405@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 ACK\r\nUser-Agent: Hepgen/123\r\nContent-Length: 0\r\n\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:srcIp,
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"BYE sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 102 BYE\r\nUser-Agent: Hepgen/123\r\nContent-Length: 0\r\n\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:srcIp,
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nCall-ID: "+callId+"\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCSeq: 102 BYE\r\nContent-Length: 0\r\n\r\n\r\n",
},
]
};
module.exports = config;
121 changes: 121 additions & 0 deletions config/loop_simple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/* HEPGEN Autogenerated from file => pcap2021-08-17T16 22 30.428Z.txt */
var callId = Math.random().toString(36).substring(7) + '@127.0.0.1';

var config = {
NAME:"HEPGEN Simple Call 1 Leg for Looping",
HEP_SERVER:"127.0.0.1",
HEP_PORT:9060,
HEP_ID:"2001",
HEP_AUTH:"myHep",
MESSAGES: [
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"169.141.53.213",
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"INVITE sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nContact: <sip:405@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nAllow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS\r\nSupported: replaces, 100rel, timer, norefersub\r\nSession-Expires: 1800\r\nMin-SE: 90\r\nUser-Agent: Hepgen/123\r\nContent-Type: application/sdp\r\nContent-Length: 319\r\n\r\nv=0\r\no=- 3837167151 3837167151 IN IP4 192.168.153.1\r\ns=HepGen 127.0.0.1\r\nb=AS:84\r\nt=0 0\r\na=X-nat:0\r\nm=audio 4000 RTP/AVP 8 101\r\nc=IN IP4 192.168.153.1\r\nb=TIAS:64000\r\na=rtcp:4001 IN IP4 192.168.153.1\r\na=sendrecv\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 telephone-event/8000\r\na=fmtp:101 0-16\r\na=ssrc:1889210388 cname:1a107f3e441a1640\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:"169.141.53.213",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 100 Trying\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nServer: Hepgen Fake 123\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\nSupported: replaces, timer\r\nSession-Expires: 1800;refresher=uas\r\nContact: <sip:405@sip.botauro.com>\r\nContent-Length: 319\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:"169.141.53.213",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 INVITE\r\nServer: Hepgen Fake 123\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\nSupported: replaces, timer\r\nSession-Expires: 1800;refresh=uas\r\nContact: <sip:405@sip.botauro.com>\r\nRequire: timer\r\nContent-Type: application/sdp\r\nContent-Length: 254\r\n\r\nv=0\r\no=root 1850387284 1850387284 IN IP4 169.141.53.213\r\ns=Asterisk PBX 16.17.0.1\r\nc=IN IP4 169.141.53.213\r\nt=0 0\r\nm=audio 16110 RTP/AVP 8 101\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 telephone-event/8000\r\na=fmtp:101 0-16\r\na=ptime:20\r\na=maxptime:150\r\na=sendrecv\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"169.141.53.213",
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"ACK sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nContact: <sip:405@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 31911 ACK\r\nUser-Agent: Hepgen/123\r\nContent-Length: 0\r\n\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"137.25.72.83",
dstIp:"169.141.53.213",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"BYE sip:5000@sip.botauro.com SIP/2.0\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nMax-Forwards: 70\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCall-ID: "+callId+"\r\nCSeq: 102 BYE\r\nUser-Agent: Hepgen/123\r\nContent-Length: 0\r\n\r\n\r\n",
},
{
rcinfo:{
type:"HEP",
version:3,
payload_type:1,
captureId:"2001",
capturePass:"myHep",
ip_family:2,
protocol:17,
proto_type:1,
srcIp:"169.141.53.213",
dstIp:"137.25.72.83",
srcPort:5060,
dstPort:5060,
},
pause:1,
payload:"SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 169.141.53.213:5060\r\nCall-ID: "+callId+"\r\nFrom: <sip:405@sip.botauro.com>\r\nTo: <sip:5000@sip.botauro.com>\r\nCSeq: 102 BYE\r\nContent-Length: 0\r\n\r\n\r\n",
},
]
};
module.exports = config;
Loading