Skip to content

Commit bc3e724

Browse files
committed
add: [pibs] skeleton for creating bgp ranking lists
1 parent 8135631 commit bc3e724

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

bin/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: pibs pibs-stat
1+
all: pibs pibs-stat pibs-BGP-Ranking
22

33
pibs-stat: pibs-stat.o libpibs.o memutils.o synseen.o
44
gcc -Wall -o pibs-stat pibs-stat.o libpibs.o memutils.o synseen.o -lwiretap `pkg-config --libs glib-2.0` -lpcap -lhiredis -ggdb
@@ -7,6 +7,12 @@ pibs-stat: pibs-stat.o libpibs.o memutils.o synseen.o
77
pibs-stat.o: pibs-stat.c
88
gcc -D HASHDEBUG=0 -Wall -c pibs-stat.c `pkg-config --cflags glib-2.0` -I /usr/include/wireshark/wiretap -I /usr/include/wireshark/wsutil -I /usr/include/wireshark `pkg-config --libs glib-2.0` -I /usr/local/include/hiredis -ggdb
99

10+
pibs-BGP-Ranking: pibs pibs-BGP-Ranking.o libpibs.o memutils.o synseen.o
11+
gcc -Wall -o pibs-BGP-Ranking pibs-BGP-Ranking.o libpibs.o memutils.o synseen.o -lwiretap `pkg-config --libs glib-2.0` -lpcap -lhiredis -ggdb
12+
13+
pibs-BGP-Ranking.o: pibs-BGP-Ranking.c
14+
gcc -D HASHDEBUG=0 -Wall -c pibs-BGP-Ranking.c `pkg-config --cflags glib-2.0` -I /usr/include/wireshark/wiretap -I /usr/include/wireshark/wsutil -I /usr/include/wireshark `pkg-config --libs glib-2.0` -I /usr/local/include/hiredis -ggdb
15+
1016
pibs: pibs.o memutils.o synseen.o libpibs.o
1117
gcc -Wall -o pibs pibs.o memutils.o synseen.o libpibs.o -lwiretap `pkg-config --libs glib-2.0` -lpcap -lhiredis -ggdb
1218

@@ -25,4 +31,6 @@ pibs.o: pibs.c
2531

2632
clean:
2733
-rm pibs
34+
-rm pibs-stat
35+
-rm pibs-BGP-Ranking
2836
-rm *.o

bin/pibs-BGP-Ranking.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* pibs - Create lists of targets under SYN floods for bgp ranking
3+
*
4+
* Copyright (C) 2019 Gerard Wagener
5+
* Copyright (C) 2019 CIRCL Computer Incident Response Center Luxembourg
6+
* (SMILE gie).
7+
*
8+
* This program is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Affero General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Affero General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*/
21+
#include <stdio.h>
22+
#include "pibs.h"
23+
24+
void usage(void)
25+
{
26+
printf("Create lists of targets under SYN floods for BGP Ranking\n");
27+
printf("\n");
28+
printf("OPTIONS\n");
29+
printf(" -h Shows this screen\n");
30+
printf(" -r inputfile\n");
31+
printf(" Read pcap file from inputfile\n");
32+
printf(" -d directory\n");
33+
printf(" Root directory where the list should be stored\n");
34+
printf("\n");
35+
printf("DIRECTORY STRUCTURE\n");
36+
printf("<directory>/port/year/month/year-month-day.txt\n");
37+
}
38+
39+
int main(int argc, char* argv[])
40+
{
41+
pibs_t* pibs;
42+
int opt;
43+
44+
45+
pibs = init();
46+
while ((opt = getopt(argc, argv, "hr:d:")) != -1) {
47+
printf("%d\n", opt);
48+
switch (opt) {
49+
case 'h':
50+
usage();
51+
break;
52+
case 'r':
53+
strncpy(pibs->filename, optarg, FILENAME_MAX);
54+
break;
55+
}
56+
}
57+
58+
if (pibs->filename[0]) {
59+
process_file(pibs);
60+
}
61+
62+
return EXIT_SUCCESS;
63+
}

0 commit comments

Comments
 (0)