Coder Social home page Coder Social logo

libcrafter's People

Contributors

abigagli avatar fduchene avatar independent-scientist avatar lancealt avatar oliviertilmans avatar pellegre avatar rarad avatar

Watchers

 avatar

libcrafter's Issues

Bug on the RawString method of the Layer class

What steps will reproduce the problem?

        RawLayer raw_header;
        raw_header.SetPayload("SomePayload");
        raw_header.RawString();

What is the expected output? What do you see instead?

The program should print the hex string of the raw header, instead a 
segmentation fault happens. 

Program received signal SIGSEGV, Segmentation fault.
0x001616a5 in Crafter::Layer::RawString (this=0xbffff5b4) at 
crafter/Layer.cpp:109
109         std::cout << std::hex << (unsigned int)((byte *)raw_data)[i];
(gdb) where
#0  0x001616a5 in Crafter::Layer::RawString (this=0xbffff5b4) at 
crafter/Layer.cpp:109
#1  0x08049bbf in main ()
(gdb) p i
$1 = 0
(gdb) list crafter/Layer.cpp:109
104 /* Print Payload */
105 void Crafter::Layer::RawString() const {
106     /* Print raw data in hexadecimal format */
107     for(size_t i = 0 ; i < bytes_size ; i++) {
108         std::cout << "\\x";
109         std::cout << std::hex << (unsigned int)((byte *)raw_data)[i];
110     }
111 
112     LayerPayload.Print();
113 

There is a bug on the RawString method of the Layer class.

Original issue reported on code.google.com by [email protected] on 22 Apr 2012 at 10:57

New Protocols

The following protocols must be implemented ASAP (listed in order of priority):

 * DHCP
 * IPv6
 * IPSec
 * BGP
 * IGMP


Original issue reported on code.google.com by [email protected] on 2 Apr 2012 at 10:36

MacOS X - Not working

Hi, 

I have tryed to compile on mac os x, but it not working; you can fix the code 
for use it?

Thanks.


Original issue reported on code.google.com by antwal on 16 Feb 2014 at 10:17

File Input/Output

A common suggestion from several people is that the library should provide the 
posibility to write packets using the functions `Print`, `HexDump`, etc. to 
output files (using `ofstreams`).

Another common suggestion is that the library should be able to read and write 
files in pcap format.

Taking note for next release...



Original issue reported on code.google.com by [email protected] on 2 Apr 2012 at 9:33

BindLinkSocketToInterface() -> Getting Interface index: No such device

What steps will reproduce the problem?
1.Run the Hello world program
2.
3.

What is the expected output? What do you see instead?
I get the following error-
BindLinkSocketToInterface() -> Getting Interface index: No such device
in my Fedora machine. I use crafter-0.2.
Please help

What version of the product are you using? On what operating system?
Crafter-0.2
Fedora OS

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Sep 2014 at 12:59

Support SLL data link layer

Currently, Ethernet is the only data link layer supported by libcrafter. A very 
common data link layer (pseudo) protocol is SLL (Linux cooked-mode capture), 
which is used, for example, when capturing from the "any" device using libpcap. 
It also appears with other types of devices, such as PPP or virtual network 
cards in virtual hosts.

Currently, it is possible to parse packets obtained from libpcap from this kind 
of interface with the following code:

---- snip ----
#define SLL_HEADER_LEN 16
/* ... do something ... */
char* data;
int len;
/* ... obtain data ... */
Packet p;
p.PacketFromIP(data + SLL_HEADER_LEN, len - SLL_HEADER_LEN);
/* ... do something ... */
---- snip ----

It would be good to have a Packet::PacketFromSLL(...) or even a more generic 
Packet::PacketFromDatalinkLayer (which would need to figure out what kind of 
interface the packet came from).

Original issue reported on code.google.com by [email protected] on 27 Apr 2012 at 4:49

Build issue

The make fails on a recent Fedora:

<snip>
crafter/DNS.cpp:460:47: error: call of overloaded 
‘SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, __ns_sect, 
ns_msg*)’ is ambiguous
crafter/DNS.cpp:460:47: note: candidates are:
crafter/DNS.cpp:338:13: note: void 
SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, ns_sect, ns_msg*)
crafter/DNS.h:252:15: note: void 
Crafter::SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, ns_sect, 
ns_msg*)
crafter/DNS.cpp:461:48: error: call of overloaded 
‘SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, __ns_sect, 
ns_msg*)’ is ambiguous
crafter/DNS.cpp:461:48: note: candidates are:
crafter/DNS.cpp:338:13: note: void 
SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, ns_sect, ns_msg*)
crafter/DNS.h:252:15: note: void 
Crafter::SetContainerSection(std::vector<Crafter::DNS::DNSAnswer>&, ns_sect, 
ns_msg*)
make[1]: *** [crafter/DNS.lo] Error 1
make[1]: Leaving directory 
`/home/fab/Documents/repos/rpmbuild/SOURCES/crafter-0.1'
make: *** [all] Error 2

Original issue reported on code.google.com by [email protected] on 14 Apr 2012 at 3:39

Libcrafter generates bad Checksum with IP OPTION length of 40 bytes

What steps will reproduce the problem?
1.Set IP option, and generate 38 byte payload
          unsigned char opt_arr[40];
          ip_opt_h.SetOption(8);
          ip_opt_h.SetPayload(opt_arr,38);


here is the IP header of the pkt with bad Checksum,

#        4f 00 02 fe 00 00 40 00 40 06 5c 20 be 6b d2 d3 
#    41 94 2d 2c 88 28 d8 54 c4 05 b4 67 ea 22 b5 b3 
#    2b ac 3e 11 5e 2a 6c 63 69 8e e2 c1 ac db b2 91 
#    73 f3 38 aa 6b 10 fe 30 15 b3 97 ff



Original issue reported on code.google.com by [email protected] on 6 Nov 2014 at 7:39

Creating a branch which works on Windows

Hi,

In my last issue, I talked about bringing the code in Windows/MinGW. I think 
many programmers need it. I've done some changes in the Libcrafter-0.2 to make 
it usable for Windows/MinGW.

Do you agree to create a branch or something else of this project for Windows? 
If yes, I can send you the code.

Original issue reported on code.google.com by [email protected] on 30 May 2013 at 12:06

Files generated by compiling process are not in .gitignore

What steps will reproduce the problem?
1. Clone source code 
2. Compile it
3. Run 'git status'

What is the expected output? What do you see instead?

I expect:

---
# On branch master
nothing to commit (working directory clean)

---

I get:

---
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   libcrafter/.libs/
#   libcrafter/Makefile
#   libcrafter/config.h
#   libcrafter/config.status
#   libcrafter/crafter.pc
#   libcrafter/crafter/.deps/
#   libcrafter/crafter/.dirstamp
#   libcrafter/crafterconfig.h
#   libcrafter/libtool
#   libcrafter/stamp-h1
#   libcrafter/stamp-h2
nothing added to commit but untracked files present (use "git add" to track)

---
What version of the product are you using? On what operating system?

1753ce8af7da9e714c430f928c83fb9c764c25c9 (HEAD) on Ubuntu Linux 11.10.

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 17 Apr 2012 at 11:06

GetFlags

What steps will reproduce the problem?
1. TCP* tcp_layer = sniff_packet->GetLayer<TCP>();
cout << "Flags: " << tcp_layer->GetFlags() << endl;
2.
3.

What is the expected output? What do you see instead?
GetFlags() doesn't produce any output.

What version of the product are you using? On what operating system?
0.2

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Jan 2015 at 11:15

Attachments:

Packet::RawSocketSend fails when binding to a device

When Packet::RawSocketSend is called with a virtual network interface (such as 
"venet0"), it fails on "setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, device, 
iface.size())". Please note that in order to write to a raw socket it is not 
necessary to bind to it.

Also, the error message reads "Setting IPPROTO_IP (IP_HDRINCL) option to raw 
socket" (it should read "Setting SOL_SOCKET (SO_BINDTODEVICE) option to raw 
socket").

Original issue reported on code.google.com by [email protected] on 27 Apr 2012 at 4:55

"./configure; make; make install" doesn't work

What steps will reproduce the problem?
1. Clone the repository
2. Run ./configure && make

What is the expected output? What do you see instead?

Library compiles successfully would be expected. Instead, we see:

----
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash 
/home/bruno/lcrafter/libcrafter/missing --run aclocal-1.11 
 cd . && /bin/bash /home/bruno/lcrafter/libcrafter/missing --run automake-1.11 --gnu
Makefile.am: required file `./COPYING' not found
Makefile.am:   `automake --add-missing' can install `COPYING'
make: *** [Makefile.in] Error 1
----

What version of the product are you using? On what operating system?

Latest (1753ce8af7da9e714c430f928c83fb9c764c25c9). On Ubuntu 11.10.

Please provide any additional information below.

Running "./autogen.sh" before "./configure" solves the problem.

Original issue reported on code.google.com by [email protected] on 19 Apr 2012 at 6:30

Packet::RawSocketSend only works once

What steps will reproduce the problem?
1. Prepare a Packet object;
2. Open a raw socket;
3. Call packet.RawSocketSend(socket, interface);
4. Call packet.RawSocketSend(socket, interface) again;

What is the expected output? What do you see instead?

Two packets are sent through the network is the expected output. Instead, only 
one packet is seen.

What version of the product are you using? On what operating system?

HEAD of the repository, on Ubuntu Linux 11.10.

Please provide any additional information below.

The attached patch fixes the problem.

Original issue reported on code.google.com by [email protected] on 25 Apr 2012 at 5:28

Attachments:

libcrafter crashes when calling Packet::PacketFromIP on an ICMP raw_layer

What steps will reproduce the problem?
1. Download the attached code (trace_sniffer.cpp)
2. Compile it, run it as 'sudo ./trace_sniffer www.google.com 80'

What is the expected output? What do you see instead?

The expected output is:
----
Tracing www.google.com (74.125.224.49) at 80...
1 10.0.0.1 10.0.0.1 10.0.0.1 
2 192.168.7.254 192.168.7.254 192.168.7.254 
3 108.94.24.3 108.94.24.3 108.94.24.3 
4 * * *
5 * * *
6 12.83.39.141 12.83.39.141 * 
7 * * *
8 * * *
9 * * *
10 12.122.114.21 12.249.231.14 12.249.231.14 
11 * * *
12 209.85.249.3 209.85.249.3 * 
13 74.125.224.49 * * 
----

Instead, I see:

----
Tracing www.google.com (74.125.224.148) at 80...
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Program received signal SIGABRT, Aborted.
----

What version of the product are you using? On what operating system?

Latest (HEAD), on Ubuntu 11.10.

Please provide any additional information below.

I also attached a packet capture from the program running. Also, running 
'backtrace' on gdb gives me the following stack:

----
#0  0x00130416 in __kernel_vsyscall ()
#1  0x002d4c8f in raise () from /lib/i386-linux-gnu/libc.so.6
#2  0x002d82b5 in abort () from /lib/i386-linux-gnu/libc.so.6
#3  0x0024f4ed in __gnu_cxx::__verbose_terminate_handler() () from 
/usr/lib/i386-linux-gnu/libstdc++.so.6
#4  0x0024d283 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5  0x0024d2bf in std::terminate() () from 
/usr/lib/i386-linux-gnu/libstdc++.so.6
#6  0x0024d40e in __cxa_throw () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7  0x0024da2f in operator new(unsigned int) () from 
/usr/lib/i386-linux-gnu/libstdc++.so.6
#8  0x0024dafb in operator new[](unsigned int) () from 
/usr/lib/i386-linux-gnu/libstdc++.so.6
#9  0x00180df0 in inflate (increase=-12, this=0xb7bf2140) at 
crafter/Payload.cpp:37
#10 Crafter::Payload::inflate (this=0xb7bf2140, increase=-12) at 
crafter/Payload.cpp:34
#11 0x00180e7e in Crafter::Payload::SetPayload (this=0xb7bf2140, data=0x805f314 
"", ndata=4294967284) at crafter/Payload.cpp:76
#12 0x00175545 in Crafter::Layer::SetPayload (this=0xb7bf20f8, data=0x805f314 
"", ndata=-12) at crafter/Layer.cpp:381
#13 0x0017842f in Crafter::Packet::PacketFromIP (this=0xb7bf21d0, 
data=0x805f2e0 "E") at crafter/Packet.cpp:372
#14 0x001788a7 in Crafter::Packet::PacketFromIP (this=0xb7bf21d0, data=...) at 
crafter/Packet.cpp:587
#15 0x08049deb in packetHandler (packet=0xb7bf2248, user=0x0) at 
trace_sniffer.cpp:30
#16 0x00181e07 in process_packet (user=0x8057a30 "", header=0xb7bf22b4, 
packet=0xb7c03046 "\b") at crafter/Sniffer.cpp:59
#17 0x00446d44 in ?? () from /usr/lib/i386-linux-gnu/libpcap.so.0.8
#18 0x00449651 in pcap_loop () from /usr/lib/i386-linux-gnu/libpcap.so.0.8
#19 0x00182432 in Crafter::Sniffer::Capture (this=0xbffff5ac, count=0, 
user=0x6) at crafter/Sniffer.cpp:287
#20 0x0018254b in SpawnThread (thread_arg=0x8059318) at crafter/Sniffer.cpp:303
#21 0x0042bd31 in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#22 0x0037a46e in clone () from /lib/i386-linux-gnu/libc.so.6
----

Original issue reported on code.google.com by [email protected] on 25 Apr 2012 at 6:17

Attachments:

Failed to build and install

I followed the instructions given in the draft:

$ sudo apt-get install autoconf libtool
$ git clone https://github.com/pellegre/libcrafter
$ cd libcrafter/libcrafter
$ ./autogen.sh 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$ make
$ sudo make install
$ sudo ldconfig

When run autogen.sh the next problem is appeared. How to solve it?

michael_k@tekoia-Vostro-3560 ~/CPP/libcrafter/libcrafter $ ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal ${ACLOCAL_FLAGS} --output=aclocal.m4t
sh: 1: aclocal: not found
autoreconf: aclocal failed with exit status: 127
michael_k@tekoia-Vostro-3560 ~/CPP/libcrafter/libcrafter $ 

Regards,
Michael Kanzieper

Original issue reported on code.google.com by [email protected] on 18 May 2015 at 11:28

Load average spikes on loss of network device

What steps will reproduce the problem?
1. Run SimpleSniffer on eth0
2. ifconfig eth0 down
3. check top the load average will spike

What is the expected output? What do you see instead?
I would expect the the program to throw an error and and / or stop as it does 
if you start the program and the port doesn't exist

terminate called after throwing an instance of 'std::runtime_error'
  what():  Sniffer::Sniffer() : opening the sniffer: SIOCGIFHWADDR: No such device

What version of the product are you using? On what operating system?
Version 02 Backtrak5 r3


Original issue reported on code.google.com by [email protected] on 24 Sep 2013 at 7:34

Request for Portablity

This is a great project in Linux. But why it's not portable to other operating 
systems such as Windows/MinGW? 

There is no technical problem to do it. I personally changed it by 
 - Removing DNS related files and RawSocket files
 - Including some missed header files from Linux
 - Adding some missed functions such as inet_pton
 - Change some functions such as GetMyMac with portable codes
 - Replacing SocketSend with pcap_sendpacket in Packet::SendRecv,... 

It works fine and it's portable.

The most problem was raw-sockets (I think) but we can replace it with 
pcap_sendpacket and achieve some good functionality in Windows. 

I know my changes is ugly, but I believe we can port it and use the power of 
Libcrafter in Windows too.

Original issue reported on code.google.com by [email protected] on 8 Dec 2012 at 10:24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.