add google IPv6 addresses & process them

This commit is contained in:
bert hubert 2022-08-29 17:33:22 +02:00
parent a24f03e685
commit ed3893315d
3 changed files with 129 additions and 23 deletions

View File

@ -141,7 +141,28 @@ int main(int argc, char** argv)
22:42:25.323984 IP 13.81.0.219.29601 > 10.0.0.3.32902: tcp 1186 22:42:25.323984 IP 13.81.0.219.29601 > 10.0.0.3.32902: tcp 1186
22:42:25.323997 IP 10.0.0.3.32902 > 13.81.0.219.29601: tcp 0 22:42:25.323997 IP 10.0.0.3.32902 > 13.81.0.219.29601: tcp 0
22:42:25.327216 b0:95:75:c3:68:92 > ff:ff:ff:ff:ff:ff, RRCP-0x25 query 22:42:25.327216 b0:95:75:c3:68:92 > ff:ff:ff:ff:ff:ff, RRCP-0x25 query
16:53:11.082416 IP6 2603:8000:ae00:d301:5636:9bff:fe27:6af6.59394 > 2001:41f0:782d:1::2.29603: tcp 0
*/ */
if(line.find(" IP6 ") != string::npos) {
auto pos = line.find('>');
if(pos == string::npos)
continue;
auto pos2 = line.find('.', pos);
if(pos2 == string::npos) continue;
line.resize(pos2);
string ip = line.substr(pos+2, pos2 - pos - 2);
cout<<"IP is: '"<<ip<<"'\n";
if(tracksneg.lookup(&line.at(pos+2))) {
cout<<ip<<" negative match"<<endl;
}
else if(auto fptr = trackspos.lookup(&line.at(pos+2))) {
cout<<ip<<" match!"<<endl;
((TrackerConf*)fptr)->counter++;
}
}
else {
auto pos = line.find('>'); auto pos = line.find('>');
if(pos == string::npos) if(pos == string::npos)
continue; continue;
@ -165,6 +186,7 @@ int main(int argc, char** argv)
cout<<ip<<" match!"<<endl; cout<<ip<<" match!"<<endl;
((TrackerConf*)fptr)->counter++; ((TrackerConf*)fptr)->counter++;
} }
}
} }
sleep(1); sleep(1);

View File

@ -13,3 +13,33 @@ TEST_CASE("basic test") {
} }
TEST_CASE("IPv6 test") {
LPMWrapper t;
void* ptr = (void*)1;
t.insert("::1", ptr);
CHECK(t.lookup("::1") == ptr);
CHECK(t.lookup("::2") == 0);
}
TEST_CASE("Mixed test") {
LPMWrapper t;
void* ptr = (void*)1;
t.insert("::1", ptr);
ptr = (void*)2;
t.insert("192.168.0.0/16", ptr);
CHECK(t.lookup("::1") == (void*)1);
CHECK(t.lookup("192.168.1.1") == (void*)2);
CHECK(t.lookup("192.168.255.255") == (void*)2);
CHECK(t.lookup("10.0.0.1") == 0);
CHECK(t.lookup("172.16.2.3") == 0);
CHECK(t.lookup("1.0.0.0") == 0);
}

View File

@ -74,7 +74,19 @@
"209.85.128.0/17", "209.85.128.0/17",
"216.58.192.0/19", "216.58.192.0/19",
"216.73.80.0/20", "216.73.80.0/20",
"216.239.32.0/19"] "216.239.32.0/19",
"2001:4860::/32",
"2404:6800::/32",
"2404:f340::/32",
"2600:1900::/28",
"2606:73c0::/32",
"2607:f8b0::/32",
"2620:11a:a000::/40",
"2620:120:e000::/40",
"2800:3f0::/32",
"2a00:1450::/32",
"2c0f:fb50::/32"
]
negative=["34.80.0.0/15", negative=["34.80.0.0/15",
"34.137.0.0/16", "34.137.0.0/16",
@ -585,7 +597,49 @@
"34.118.240.0/22", "34.118.240.0/22",
"34.124.8.0/22", "34.124.8.0/22",
"34.125.0.0/16", "34.125.0.0/16",
"35.219.128.0/18"] "35.219.128.0/18",
"2600:1900:4030::/44",
"2600:1900:41a0::/44",
"2600:1900:4050::/44",
"2600:1900:41d0::/44",
"2600:1901:8180::/44",
"2600:1900:40a0::/44",
"2600:1900:41b0::/44",
"2600:1900:4080::/44",
"2600:1901:8170::/44",
"2600:1900:40b0::/44",
"2600:1900:41c0::/44",
"2600:1900:4140::/44",
"2600:1900:4150::/44",
"2600:1901:8100::/44",
"2600:1900:4010::/44",
"2600:1900:40c0::/44",
"2600:1900:40d0::/44",
"2600:1900:4060::/44",
"2600:1900:4160::/44",
"2600:1901:8110::/44",
"2600:1901:8120::/44",
"2600:1901::/48",
"2600:1901:1:1000::/52",
"2600:1901:1:2000::/51",
"2600:1901:1:4000::/50",
"2600:1901:1:8000::/49",
"2600:1900:40e0::/44",
"2600:1900:41e0::/44",
"2600:1900:40f0::/44",
"2600:1901:4010::/44",
"2600:1900:4000::/44",
"2600:1900:4070::/44",
"2600:1900:4020::/44",
"2600:1900:4090::/44",
"2600:1901:8130::/44",
"2600:1901:8150::/44",
"2600:1901:8140::/44",
"2600:1900:4040::/44",
"2600:1900:4120::/44",
"2600:1900:4170::/44",
"2600:1900:4180::/44"
]
[facebook] [facebook]
positive=["31.13.24.0/21", positive=["31.13.24.0/21",