So kompilieren und führen Sie „protoident“ aus

So kompilieren und führen Sie „protoident“ aus

Ich versuche, ein Open-Source-DPI-Tool namensProtoident. Also habe ich heruntergeladensein Quellcode von Githubund habe in den Verzeichnissen nach Kompilierungs-/Build-Handbüchern gesucht, aber nichts gefunden. Schließlich habe ich angefangen, makecommand und Makefilecommand in ihrem Verzeichnis auszuführen, aber ich habe die folgenden Fehler erhalten:

me@me-MS-7693:~/Desktop/protoident-master/src$ ./Makefile 
./Makefile: line 9: TARGET: command not found
./Makefile: line 10: PROTOCOLS: command not found
./Makefile: line 11: PROTOCOLS: command not found
./Makefile: line 11: SOURCES: command not found
./Makefile: line 12: SOURCES:.c=.h: command not found
./Makefile: line 12: HEADERS: command not found
./Makefile: line 13: SOURCES:.c=.o: command not found
./Makefile: line 13: OBJECTS: command not found
./Makefile: line 14: OTHER_FILES: command not found
./Makefile: line 18: CC: command not found
./Makefile: line 19: CFLAGS: command not found
./Makefile: line 21: OFLAG: command not found
./Makefile: line 22: CFLAG: command not found
./Makefile: line 24: CC: command not found
./Makefile: line 24: LINK: command not found
./Makefile: line 25: LINKFLAGS: command not found
./Makefile: line 26: LIBS: command not found
./Makefile: line 31: .SUFFIXES:: command not found
./Makefile: line 32: .c.o:: command not found
./Makefile: line 33: CC: command not found
./Makefile: line 33: CFLAGS: command not found
./Makefile: line 33: CFLAG: command not found
./Makefile: line 33: OFLAG: command not found
./Makefile: line 33: $<: command not found
./Makefile: line 38: SOURCES: command not found
./Makefile: line 38: TARGET: command not found
./Makefile: line 38: all:: command not found
./Makefile: line 40: profile:: command not found
./Makefile: line 41: profile_compile:: command not found
./Makefile: line 42: profile_compile:: command not found
./Makefile: line 43: profile_compile:: command not found
./Makefile: line 46: TARGET: command not found
./Makefile: line 46: OBJECTS: command not found
./Makefile: line 47: LINK: command not found
./Makefile: line 47: LINKFLAGS: command not found
./Makefile: line 47: LIBS: command not found
./Makefile: line 47: OFLAG: command not found
./Makefile: line 47: TARGET: command not found
./Makefile: line 47: OBJECTS: command not found
./Makefile: line 52: archive:: command not found
./Makefile: line 53: TARGET: command not found
./Makefile: line 53: SOURCES: command not found
./Makefile: line 53: HEADERS: command not found
./Makefile: line 53: OTHER_FILES: command not found
tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.
./Makefile: line 55: clean:: command not found
./Makefile: line 56: OBJECTS: command not found
./Makefile: line 58: distclean:: command not found
./Makefile: line 59: TARGET: command not found


me@me-MS-7693:~/Desktop/protoident-master/src$ make
gcc  -lpcap -o protoident main.o hashtable.o ip_reassembling.o flow.o global_func.o dns.o http.o sip.o smtp.o
main.o: In function `main':
/home/ghasemi/Desktop/protoident-master/src/main.c:85: undefined reference to `pcap_open_offline'
/home/ghasemi/Desktop/protoident-master/src/main.c:97: undefined reference to `pcap_compile'
/home/ghasemi/Desktop/protoident-master/src/main.c:100: undefined reference to `pcap_geterr'
/home/ghasemi/Desktop/protoident-master/src/main.c:103: undefined reference to `pcap_setfilter'
/home/ghasemi/Desktop/protoident-master/src/main.c:105: undefined reference to `pcap_geterr'
/home/ghasemi/Desktop/protoident-master/src/main.c:118: undefined reference to `pcap_datalink'
/home/ghasemi/Desktop/protoident-master/src/main.c:125: undefined reference to `pcap_loop'
/home/ghasemi/Desktop/protoident-master/src/main.c:134: undefined reference to `pcap_freecode'
/home/ghasemi/Desktop/protoident-master/src/main.c:136: undefined reference to `pcap_close'
collect2: error: ld returned 1 exit status
Makefile:47: recipe for target 'protoident' failed
make: *** [protoident] Error 1

Warum sind diese Fehler aufgetreten und wie kann ich dieses Tool kompilieren und verwenden?

Antwort1

Makefileist eine Konfigurationsdatei für make, kein separater Befehl. Die kanonischeErstellen und InstallierenIst:

./configure
make
make install   # usually: sudo make install

Die meisten Projekte beschreiben ihren Installationsprozess detailliert in Textdateien READMEoder INSTALLähnlichem.

Dieses hier hat jedoch kein configureSkript, sondern stattdessen ein „ready“ Makefile. Es enthält keinen INSTALLAbschnitt, daher ist der dritte Befehl auch nicht anwendbar.

Sie müssen also nur Folgendes ausführen:

make

READMEEs ist in der Datei im Verzeichnis dokumentiert src. Lustig ist, dass es auf Tschechisch geschrieben ist (was übrigens meine Muttersprache ist).

Beheben undefined referencevon Fehlern

Es gibt ein Problem im bereitgestellten Makefile, das mit dem folgenden Patch behoben werden kann (basierend auf einemStack Overflow-Kommentar):

diff --git a/src/Makefile b/src/Makefile
index 367dcc4..dda5fb3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -44,7 +44,7 @@ profile_compile: all


 $(TARGET): $(OBJECTS)
-       $(LINK) $(LINKFLAGS) $(LIBS) $(OFLAG) $(TARGET) $(OBJECTS)
+       $(LINK) $(LINKFLAGS) $(OFLAG) $(TARGET) $(OBJECTS) $(LIBS)

 #####################################
 #other rules

Antwort2

Ich habe mir die Anleitung unter deinem Link angesehen. Sie ist zwar zu finden, aber auf Tschechisch. Zum Beispiel:

Zdrojová a cílová síťová adresa, zdrojový a cílový port není třeba dále
vysvětlovat.

Ins Englische übersetzt als:

Source and destination network address, source and destination port does not need to be further explain.

Wenn Sie sich verschiedene Quelldateien ansehen, sehen Sie in der Beschreibung „Nicht getestet“.

Dieser Autor bezeichnet das Projekt als Experiment und es wurde seit zwei Jahren nicht aktualisiert.

Ich vermute, das Projekt ist kaputt und möglicherweise ist mit Ihrem Compiler und Ihren Make-Funktionen alles in Ordnung. Um zu bestätigen, dass Ihr System funktioniert, laden Sie von GitHub einen einfachen Rechner für den Gnome-Desktop herunter, der 200 Mitwirkende und 243 Releases hat:Gnome-Rechner. Kompilieren Sie dies anstelle Ihrer aktuellen Auswahl, die seit zwei Jahren keine Aktivität aufweist und vom Autor als Experiment bezeichnet wird.

verwandte Informationen