Beautifier 31/5/2012
This commit is contained in:
parent
888d98c7ff
commit
7ee6aabed8
20 changed files with 609 additions and 266 deletions
|
@ -31,13 +31,13 @@ target_link_libraries(riddle ${LIBPCAP})
|
|||
|
||||
target_link_libraries(cigarette ${Boost_LIBRARIES})
|
||||
target_link_libraries(cigarette ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries(cigarette commons)
|
||||
target_link_libraries(cigarette libNetwork)
|
||||
|
||||
target_link_libraries(ranging ${Boost_LIBRARIES})
|
||||
target_link_libraries(ranging ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries(ranging ${CURSES_LIBRARY})
|
||||
target_link_libraries(ranging commons)
|
||||
target_link_libraries(ranging libNetwork)
|
||||
|
||||
target_link_libraries(pursuer ${Boost_LIBRARIES})
|
||||
target_link_libraries(pursuer ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries(pursuer commons)
|
||||
target_link_libraries(pursuer libNetwork)
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft and admiral0 for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
@ -23,6 +40,7 @@
|
|||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace boost::program_options;
|
||||
using namespace libNetwork;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
options_description desc("Cigarette - Network Packet Parser");
|
||||
|
|
38
Pursuer.cpp
38
Pursuer.cpp
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft and admiral0 for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
@ -25,6 +42,7 @@
|
|||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace boost::program_options;
|
||||
using namespace libNetwork;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
options_description desc("Pursuer - Network TCP Follower");
|
||||
|
|
38
Ranging.cpp
38
Ranging.cpp
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft and admiral0 for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
@ -34,6 +51,7 @@ using namespace boost;
|
|||
using namespace boost::program_options;
|
||||
using namespace boost::gregorian;
|
||||
using namespace boost::posix_time;
|
||||
using namespace libNetwork;
|
||||
|
||||
void setHead();
|
||||
void printLine(int countLine, string mac, string ip, long int epoch, long int lastEpoch);
|
||||
|
|
37
Riddle.cpp
37
Riddle.cpp
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft and admiral0 for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
project (commons)
|
||||
|
||||
add_library (commons STATIC libAddress.h libAddress.cpp libPacket.h libPacket.cpp)
|
||||
add_library (libNetwork STATIC libAddress.h libAddress.cpp libPacket.h libPacket.cpp)
|
||||
add_library (libDump STATIC libDump.h libDump.cpp)
|
||||
|
||||
target_link_libraries (commons)
|
||||
target_link_libraries (libNetwork)
|
||||
target_link_libraries (libDump)
|
|
@ -1,21 +1,39 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include "libAddress.h"
|
||||
|
||||
|
||||
/** Costruttore */
|
||||
mac_address::mac_address(const std::string& rawData)
|
||||
libNetwork::mac_address::mac_address(const std::string& rawData)
|
||||
{
|
||||
int l = 0;
|
||||
std::string temp;
|
||||
|
@ -37,7 +55,7 @@ mac_address::mac_address(const std::string& rawData)
|
|||
}
|
||||
|
||||
/** Restituisce indirizzo stampabile */
|
||||
std::string mac_address::to_string()
|
||||
std::string libNetwork::mac_address::to_string()
|
||||
{
|
||||
std::string stamp;
|
||||
std::stringstream temp;
|
||||
|
@ -54,7 +72,7 @@ std::string mac_address::to_string()
|
|||
}
|
||||
|
||||
/** Overload, definisco confronto tra indirizzi */
|
||||
bool mac_address::operator==(const mac_address& otherMac)
|
||||
bool libNetwork::mac_address::operator==(const mac_address& otherMac)
|
||||
{
|
||||
for(int i=0; i<=5; i++)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBADDRESS_H
|
||||
#define LIBADDRESS_H
|
||||
|
@ -16,10 +33,12 @@
|
|||
#include <cstring>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace libNetwork {
|
||||
|
||||
/* Class for managing MAC address */
|
||||
class mac_address
|
||||
{
|
||||
|
||||
|
||||
private:
|
||||
uint16_t byte[6];
|
||||
|
||||
|
@ -37,4 +56,6 @@ public:
|
|||
std::string to_string();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //LIBADDRESS_H
|
||||
|
|
27
commons/libDump.cpp
Normal file
27
commons/libDump.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
27
commons/libDump.h
Normal file
27
commons/libDump.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
|
@ -1,15 +1,33 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdint.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
@ -27,7 +45,7 @@
|
|||
|
||||
using namespace boost;
|
||||
|
||||
packet* packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::packet* libNetwork::packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
|
||||
uint16_t protocol_type;
|
||||
|
@ -62,7 +80,7 @@ packet* packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string
|
|||
return p;
|
||||
}
|
||||
|
||||
packet* packet::factory(std::string packetLine)
|
||||
libNetwork::packet* libNetwork::packet::factory(std::string packetLine)
|
||||
{
|
||||
std::vector< std::string > section;
|
||||
boost::algorithm::split(section, packetLine, boost::algorithm::is_any_of("!"));
|
||||
|
@ -72,22 +90,22 @@ packet* packet::factory(std::string packetLine)
|
|||
return pkg;
|
||||
}
|
||||
|
||||
uint32_t packet::getPacketLength()
|
||||
uint32_t libNetwork::packet::getPacketLength()
|
||||
{
|
||||
return pkgLength;
|
||||
}
|
||||
|
||||
uint64_t packet::getEpoch()
|
||||
uint64_t libNetwork::packet::getEpoch()
|
||||
{
|
||||
return timeEpoch;
|
||||
}
|
||||
|
||||
uint32_t packet::getMillis()
|
||||
uint32_t libNetwork::packet::getMillis()
|
||||
{
|
||||
return timeMillis;
|
||||
}
|
||||
|
||||
std::string packet::getHexString(int string_cursor, int read_byte)
|
||||
std::string libNetwork::packet::getHexString(int string_cursor, int read_byte)
|
||||
{
|
||||
std::string temp;
|
||||
temp.reserve(read_byte * 2);
|
||||
|
@ -102,7 +120,7 @@ std::string packet::getHexString(int string_cursor, int read_byte)
|
|||
return temp;
|
||||
}
|
||||
|
||||
std::string packet::getDecimalIP(int string_cursor)
|
||||
std::string libNetwork::packet::getDecimalIP(int string_cursor)
|
||||
{
|
||||
std::string temp;
|
||||
std::string stamp;
|
||||
|
@ -124,38 +142,38 @@ std::string packet::getDecimalIP(int string_cursor)
|
|||
return stamp;
|
||||
}
|
||||
|
||||
mac_address packet::getMacAddress(int string_cursor)
|
||||
libNetwork::mac_address libNetwork::packet::getMacAddress(int string_cursor)
|
||||
{
|
||||
mac_address mac_temp(this->getHexString(string_cursor, 6));
|
||||
return mac_temp;
|
||||
}
|
||||
|
||||
bool packet::isArp()
|
||||
bool libNetwork::packet::isArp()
|
||||
{
|
||||
return (this->getEtherType() == ETHER_TYPE_ARP);
|
||||
}
|
||||
|
||||
bool packet::isIPv4()
|
||||
bool libNetwork::packet::isIPv4()
|
||||
{
|
||||
return (this->getEtherType() == ETHER_TYPE_IPV4);
|
||||
}
|
||||
|
||||
bool packet::isIPv6()
|
||||
bool libNetwork::packet::isIPv6()
|
||||
{
|
||||
return (this->getEtherType() == ETHER_TYPE_IPV6);
|
||||
}
|
||||
|
||||
mac_address packet::getSenderMac()
|
||||
libNetwork::mac_address libNetwork::packet::getSenderMac()
|
||||
{
|
||||
return this->getMacAddress(6);
|
||||
}
|
||||
|
||||
mac_address packet::getTargetMac()
|
||||
libNetwork::mac_address libNetwork::packet::getTargetMac()
|
||||
{
|
||||
return this->getMacAddress(0);
|
||||
}
|
||||
|
||||
uint16_t packet::getEtherType()
|
||||
uint16_t libNetwork::packet::getEtherType()
|
||||
{
|
||||
uint16_t protocol_type;
|
||||
|
||||
|
@ -168,7 +186,7 @@ uint16_t packet::getEtherType()
|
|||
|
||||
/* ARP */
|
||||
|
||||
ARPpacket::ARPpacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::ARPpacket::ARPpacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
|
||||
timeEpoch = timeEpoch_i;
|
||||
|
@ -178,7 +196,7 @@ ARPpacket::ARPpacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string ra
|
|||
return;
|
||||
}
|
||||
|
||||
uint16_t ARPpacket::getOpCode()
|
||||
uint16_t libNetwork::ARPpacket::getOpCode()
|
||||
{
|
||||
uint16_t opcode;
|
||||
|
||||
|
@ -189,13 +207,13 @@ uint16_t ARPpacket::getOpCode()
|
|||
}
|
||||
|
||||
|
||||
boost::asio::ip::address ARPpacket::getSenderIp()
|
||||
boost::asio::ip::address libNetwork::ARPpacket::getSenderIp()
|
||||
{
|
||||
boost::asio::ip::address newaddr = boost::asio::ip::address::from_string(this->getDecimalIP(ARP_OFFSET+14));
|
||||
return newaddr;
|
||||
}
|
||||
|
||||
boost::asio::ip::address ARPpacket::getTargetIp()
|
||||
boost::asio::ip::address libNetwork::ARPpacket::getTargetIp()
|
||||
{
|
||||
boost::asio::ip::address newaddr = boost::asio::ip::address::from_string(this->getDecimalIP(ARP_OFFSET+24));
|
||||
return newaddr;
|
||||
|
@ -203,7 +221,7 @@ boost::asio::ip::address ARPpacket::getTargetIp()
|
|||
|
||||
/* IPV4 */
|
||||
|
||||
packet* IPv4packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::packet* libNetwork::IPv4packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
uint16_t protocol_type;
|
||||
|
||||
|
@ -242,19 +260,19 @@ packet* IPv4packet::factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::st
|
|||
return p;
|
||||
}
|
||||
|
||||
asio::ip::address IPv4packet::getSenderIp()
|
||||
asio::ip::address libNetwork::IPv4packet::getSenderIp()
|
||||
{
|
||||
boost::asio::ip::address newaddr = boost::asio::ip::address::from_string(this->getDecimalIP(IPv4_OFFSET+12));
|
||||
return newaddr;
|
||||
}
|
||||
|
||||
asio::ip::address IPv4packet::getTargetIp()
|
||||
asio::ip::address libNetwork::IPv4packet::getTargetIp()
|
||||
{
|
||||
boost::asio::ip::address newaddr = boost::asio::ip::address::from_string(this->getDecimalIP(IPv4_OFFSET+16));
|
||||
return newaddr;
|
||||
}
|
||||
|
||||
uint16_t IPv4packet::getIdentity()
|
||||
uint16_t libNetwork::IPv4packet::getIdentity()
|
||||
{
|
||||
uint16_t id;
|
||||
|
||||
|
@ -264,7 +282,7 @@ uint16_t IPv4packet::getIdentity()
|
|||
return id;
|
||||
}
|
||||
|
||||
uint16_t IPv4packet::getTTL()
|
||||
uint16_t libNetwork::IPv4packet::getTTL()
|
||||
{
|
||||
uint16_t ttl;
|
||||
|
||||
|
@ -274,7 +292,7 @@ uint16_t IPv4packet::getTTL()
|
|||
return ttl;
|
||||
}
|
||||
|
||||
uint16_t IPv4packet::getProtocolType()
|
||||
uint16_t libNetwork::IPv4packet::getProtocolType()
|
||||
{
|
||||
uint16_t protocol_type;
|
||||
|
||||
|
@ -284,7 +302,7 @@ uint16_t IPv4packet::getProtocolType()
|
|||
return protocol_type;
|
||||
}
|
||||
|
||||
uint16_t IPv4packet::getIPChecksum()
|
||||
uint16_t libNetwork::IPv4packet::getIPChecksum()
|
||||
{
|
||||
uint16_t cs;
|
||||
std::stringstream convert (this->getHexString(IPv4_OFFSET+10, 2));
|
||||
|
@ -292,7 +310,7 @@ uint16_t IPv4packet::getIPChecksum()
|
|||
return cs;
|
||||
}
|
||||
|
||||
bool IPv4packet::verifyIPChecksum()
|
||||
bool libNetwork::IPv4packet::verifyIPChecksum()
|
||||
{
|
||||
|
||||
int sum = 0;
|
||||
|
@ -310,24 +328,24 @@ bool IPv4packet::verifyIPChecksum()
|
|||
return ((sum & 0xFFFF) + (sum >>= 16) == 0xFFFF);
|
||||
}
|
||||
|
||||
bool IPv4packet::isTCP()
|
||||
bool libNetwork::IPv4packet::isTCP()
|
||||
{
|
||||
return (this->getProtocolType() == IPV4_TYPE_TCP);
|
||||
}
|
||||
|
||||
bool IPv4packet::isUDP()
|
||||
bool libNetwork::IPv4packet::isUDP()
|
||||
{
|
||||
return (this->getProtocolType() == IPV4_TYPE_UDP);
|
||||
}
|
||||
|
||||
bool IPv4packet::isICMP()
|
||||
bool libNetwork::IPv4packet::isICMP()
|
||||
{
|
||||
return (this->getProtocolType() == IPV4_TYPE_ICMP);
|
||||
}
|
||||
|
||||
/* ICMP */
|
||||
|
||||
ICMPv4packet::ICMPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::ICMPv4packet::ICMPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
timeEpoch = timeEpoch_i;
|
||||
timeMillis = timeMillis_i;
|
||||
|
@ -336,7 +354,7 @@ ICMPv4packet::ICMPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::str
|
|||
return;
|
||||
}
|
||||
|
||||
uint16_t ICMPv4packet::getMessageType()
|
||||
uint16_t libNetwork::ICMPv4packet::getMessageType()
|
||||
{
|
||||
uint16_t message_type;
|
||||
|
||||
|
@ -346,7 +364,7 @@ uint16_t ICMPv4packet::getMessageType()
|
|||
return message_type;
|
||||
}
|
||||
|
||||
uint16_t ICMPv4packet::getMessageCode()
|
||||
uint16_t libNetwork::ICMPv4packet::getMessageCode()
|
||||
{
|
||||
uint16_t message_code;
|
||||
|
||||
|
@ -358,7 +376,7 @@ uint16_t ICMPv4packet::getMessageCode()
|
|||
|
||||
/* TCP */
|
||||
|
||||
TCPv4packet::TCPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::TCPv4packet::TCPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
timeEpoch = timeEpoch_i;
|
||||
timeMillis = timeMillis_i;
|
||||
|
@ -368,7 +386,7 @@ TCPv4packet::TCPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::strin
|
|||
return;
|
||||
}
|
||||
|
||||
uint16_t TCPv4packet::getSenderPort()
|
||||
uint16_t libNetwork::TCPv4packet::getSenderPort()
|
||||
{
|
||||
uint16_t port;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET, 2));
|
||||
|
@ -376,7 +394,7 @@ uint16_t TCPv4packet::getSenderPort()
|
|||
return port;
|
||||
}
|
||||
|
||||
uint16_t TCPv4packet::getTargetPort()
|
||||
uint16_t libNetwork::TCPv4packet::getTargetPort()
|
||||
{
|
||||
uint16_t port;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+2, 2));
|
||||
|
@ -384,7 +402,7 @@ uint16_t TCPv4packet::getTargetPort()
|
|||
return port;
|
||||
}
|
||||
|
||||
uint32_t TCPv4packet::getSequenceNumber()
|
||||
uint32_t libNetwork::TCPv4packet::getSequenceNumber()
|
||||
{
|
||||
uint32_t sn;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+4, 4));
|
||||
|
@ -392,7 +410,7 @@ uint32_t TCPv4packet::getSequenceNumber()
|
|||
return sn;
|
||||
}
|
||||
|
||||
uint32_t TCPv4packet::getAcknowledgmentNumber()
|
||||
uint32_t libNetwork::TCPv4packet::getAcknowledgmentNumber()
|
||||
{
|
||||
uint32_t an;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+8, 4));
|
||||
|
@ -400,7 +418,7 @@ uint32_t TCPv4packet::getAcknowledgmentNumber()
|
|||
return an;
|
||||
}
|
||||
|
||||
unsigned int TCPv4packet::getHeaderLength()
|
||||
unsigned int libNetwork::TCPv4packet::getHeaderLength()
|
||||
{
|
||||
/*
|
||||
* Sono utilizzati solo i primi 8 bit del byte, necessita traslazione.
|
||||
|
@ -414,12 +432,12 @@ unsigned int TCPv4packet::getHeaderLength()
|
|||
return hl;
|
||||
}
|
||||
|
||||
unsigned int TCPv4packet::getPayloadLength()
|
||||
unsigned int libNetwork::TCPv4packet::getPayloadLength()
|
||||
{
|
||||
return (this->getPayLoad().length())/2;
|
||||
}
|
||||
|
||||
int TCPv4packet::getFlags()
|
||||
int libNetwork::TCPv4packet::getFlags()
|
||||
{
|
||||
int flag;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+13, 1));
|
||||
|
@ -427,7 +445,7 @@ int TCPv4packet::getFlags()
|
|||
return flag;
|
||||
}
|
||||
|
||||
unsigned int TCPv4packet::getWindowSize()
|
||||
unsigned int libNetwork::TCPv4packet::getWindowSize()
|
||||
{
|
||||
unsigned int ws;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+14, 2));
|
||||
|
@ -435,7 +453,7 @@ unsigned int TCPv4packet::getWindowSize()
|
|||
return ws;
|
||||
}
|
||||
|
||||
unsigned int TCPv4packet::getTCPChecksum()
|
||||
unsigned int libNetwork::TCPv4packet::getTCPChecksum()
|
||||
{
|
||||
unsigned int cs;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+16, 2));
|
||||
|
@ -443,12 +461,12 @@ unsigned int TCPv4packet::getTCPChecksum()
|
|||
return cs;
|
||||
}
|
||||
|
||||
bool TCPv4packet::verifyTCPChecksum()
|
||||
bool libNetwork::TCPv4packet::verifyTCPChecksum()
|
||||
{
|
||||
// TODO - Checksum TCP non viene usato???
|
||||
}
|
||||
|
||||
unsigned int TCPv4packet::getUrgentPointer()
|
||||
unsigned int libNetwork::TCPv4packet::getUrgentPointer()
|
||||
{
|
||||
unsigned int up;
|
||||
std::stringstream convert (this->getHexString(TCP_OFFSET+18, 2));
|
||||
|
@ -456,12 +474,12 @@ unsigned int TCPv4packet::getUrgentPointer()
|
|||
return up;
|
||||
}
|
||||
|
||||
std::string TCPv4packet::getOptionRaw()
|
||||
std::string libNetwork::TCPv4packet::getOptionRaw()
|
||||
{
|
||||
return this->getHexString(TCP_OFFSET + TCP_STANDARD, this->getHeaderLength() - TCP_STANDARD);
|
||||
}
|
||||
|
||||
std::map< int, std::string > TCPv4packet::getOptionMap()
|
||||
std::map< int, std::string > libNetwork::TCPv4packet::getOptionMap()
|
||||
{
|
||||
std::map<int, std::string> tempMap;
|
||||
if(this->isOption() && !this->isSYN()) // FIXME - SYN usa altro protocollo???
|
||||
|
@ -485,60 +503,60 @@ std::map< int, std::string > TCPv4packet::getOptionMap()
|
|||
return tempMap;
|
||||
}
|
||||
|
||||
std::string TCPv4packet::getPayLoad()
|
||||
std::string libNetwork::TCPv4packet::getPayLoad()
|
||||
{
|
||||
int start = TCP_OFFSET + this->getHeaderLength();
|
||||
return this->getHexString(start, this->getPacketLength() - start);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isCWR()
|
||||
bool libNetwork::TCPv4packet::isCWR()
|
||||
{
|
||||
return (this->getFlags() & 128);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isECE()
|
||||
bool libNetwork::TCPv4packet::isECE()
|
||||
{
|
||||
return (this->getFlags() & 64);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isURG()
|
||||
bool libNetwork::TCPv4packet::isURG()
|
||||
{
|
||||
return (this->getFlags() & 32);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isACK()
|
||||
bool libNetwork::TCPv4packet::isACK()
|
||||
{
|
||||
return (this->getFlags() & 16);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isPSH()
|
||||
bool libNetwork::TCPv4packet::isPSH()
|
||||
{
|
||||
return (this->getFlags() & 8);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isRST()
|
||||
bool libNetwork::TCPv4packet::isRST()
|
||||
{
|
||||
return (this->getFlags() & 4);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isSYN()
|
||||
bool libNetwork::TCPv4packet::isSYN()
|
||||
{
|
||||
return (this->getFlags() & 2);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isFIN()
|
||||
bool libNetwork::TCPv4packet::isFIN()
|
||||
{
|
||||
return (this->getFlags() & 1);
|
||||
}
|
||||
|
||||
bool TCPv4packet::isOption()
|
||||
bool libNetwork::TCPv4packet::isOption()
|
||||
{
|
||||
return (this->getHeaderLength() > TCP_STANDARD);
|
||||
}
|
||||
|
||||
/* UDP */
|
||||
|
||||
UDPv4packet::UDPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::UDPv4packet::UDPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
timeEpoch = timeEpoch_i;
|
||||
timeMillis = timeMillis_i;
|
||||
|
@ -547,17 +565,17 @@ UDPv4packet::UDPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::strin
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned int UDPv4packet::getSenderPort()
|
||||
uint16_t libNetwork::UDPv4packet::getSenderPort()
|
||||
{
|
||||
unsigned int port;
|
||||
uint16_t port;
|
||||
std::stringstream convert (this->getHexString(UDP_OFFSET, 2));
|
||||
convert>>std::hex>>port;
|
||||
return port;
|
||||
}
|
||||
|
||||
unsigned int UDPv4packet::getTargetPort()
|
||||
uint16_t libNetwork::UDPv4packet::getTargetPort()
|
||||
{
|
||||
unsigned int port;
|
||||
uint16_t port;
|
||||
std::stringstream convert (this->getHexString(UDP_OFFSET+2, 2));
|
||||
convert>>std::hex>>port;
|
||||
return port;
|
||||
|
@ -565,7 +583,7 @@ unsigned int UDPv4packet::getTargetPort()
|
|||
|
||||
/* UNKNOWN */
|
||||
|
||||
UnknownPacket::UnknownPacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
libNetwork::UnknownPacket::UnknownPacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i)
|
||||
{
|
||||
timeEpoch = timeEpoch_i;
|
||||
timeMillis = timeMillis_i;
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBHEADER_H
|
||||
#define LIBHEADER_H
|
||||
|
@ -57,10 +74,12 @@
|
|||
#include <stdint.h>
|
||||
#include "libAddress.h"
|
||||
|
||||
namespace libNetwork {
|
||||
|
||||
/** Class for managing packets */
|
||||
class packet
|
||||
{
|
||||
|
||||
|
||||
protected:
|
||||
uint64_t timeEpoch; /** Timestamp */
|
||||
uint32_t timeMillis; /** Millisecond from timestamp */
|
||||
|
@ -77,7 +96,7 @@ public:
|
|||
|
||||
/** Class constructor with delayed instantiation, auto-split mode*/
|
||||
static packet* factory(std::string packetLine);
|
||||
|
||||
|
||||
/** Virtual destructor */
|
||||
virtual ~packet() {}
|
||||
|
||||
|
@ -130,16 +149,16 @@ public:
|
|||
class ARPpacket : public packet
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/** Costruttore finale */
|
||||
ARPpacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i);
|
||||
|
||||
|
||||
/** Ritorna OpCode */
|
||||
uint16_t getOpCode();
|
||||
|
||||
|
||||
/** Ritorna indirizzo IP del mittente */
|
||||
boost::asio::ip::address getSenderIp();
|
||||
|
||||
|
||||
/** Ritorna indirizzo IP del destinatario */
|
||||
boost::asio::ip::address getTargetIp();
|
||||
};
|
||||
|
@ -151,25 +170,25 @@ public:
|
|||
|
||||
/** Class constructor with delayed instantiation */
|
||||
static packet* factory(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i);
|
||||
|
||||
|
||||
/** Ritorna indirizzo IP del mittente */
|
||||
boost::asio::ip::address getSenderIp();
|
||||
|
||||
/** Ritorna indirizzo IP del destinatario */
|
||||
boost::asio::ip::address getTargetIp();
|
||||
|
||||
|
||||
/** Ritorna identificatore **/
|
||||
uint16_t getIdentity();
|
||||
|
||||
|
||||
/** Ritorna il Time To Live **/
|
||||
uint16_t getTTL();
|
||||
|
||||
/** Ritorna il tipo di protocollo incapsulato */
|
||||
uint16_t getProtocolType();
|
||||
|
||||
|
||||
/** Ritorna checksum */
|
||||
uint16_t getIPChecksum();
|
||||
|
||||
|
||||
/** Verify checksum **/
|
||||
bool verifyIPChecksum();
|
||||
|
||||
|
@ -189,7 +208,7 @@ class TCPv4packet : public IPv4packet
|
|||
public:
|
||||
|
||||
/** Flag pubblica usabile per marcare uno specifico oggetto TCPv4packet **/
|
||||
bool public_flag;
|
||||
bool public_flag;
|
||||
|
||||
/** Costruttore finale */
|
||||
TCPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i);
|
||||
|
@ -208,7 +227,7 @@ public:
|
|||
|
||||
/** Ritorna dimensione dell'header TCP in byte */
|
||||
unsigned int getHeaderLength();
|
||||
|
||||
|
||||
/** Ritorna dimensione del payload TCP in byte */
|
||||
unsigned int getPayloadLength();
|
||||
|
||||
|
@ -220,10 +239,10 @@ public:
|
|||
|
||||
/** Ritorna checksum */
|
||||
unsigned int getTCPChecksum();
|
||||
|
||||
|
||||
/** Verify checksum **/
|
||||
bool verifyTCPChecksum();
|
||||
|
||||
|
||||
/** Ritorna l'urgent pointer */
|
||||
unsigned int getUrgentPointer();
|
||||
|
||||
|
@ -273,10 +292,10 @@ public:
|
|||
UDPv4packet(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i);
|
||||
|
||||
/** Ritorna porta UDP del mittente */
|
||||
unsigned int getSenderPort();
|
||||
uint16_t getSenderPort();
|
||||
|
||||
/** Ritorna porta UDP del destinatario */
|
||||
unsigned int getTargetPort();
|
||||
uint16_t getTargetPort();
|
||||
};
|
||||
|
||||
/** Class for managing ICMPv4 packets */
|
||||
|
@ -303,4 +322,6 @@ public:
|
|||
UnknownPacket(uint64_t timeEpoch_i, uint32_t timeMillis_i, std::string rawData_i);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //LIBHEADER_H
|
||||
|
|
|
@ -1,16 +1,34 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "libCigarette.h"
|
||||
|
||||
|
@ -66,3 +84,4 @@ std::string icmpv4_type_decode(uint16_t start)
|
|||
return "UNDEFINED";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBCIGARETTE_H
|
||||
#define LIBCIGARETTE_H
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
@ -43,7 +60,7 @@ std::string decodeHexText(std::string raw)
|
|||
|
||||
}
|
||||
|
||||
bool stream::factory(TCPv4packet *packet)
|
||||
bool stream::factory(libNetwork::TCPv4packet *packet)
|
||||
{
|
||||
|
||||
if(packet->isSYN())
|
||||
|
@ -89,7 +106,7 @@ bool stream::factory(TCPv4packet *packet)
|
|||
}
|
||||
|
||||
|
||||
bool stream::addPacket(TCPv4packet *newPacket)
|
||||
bool stream::addPacket(libNetwork::TCPv4packet *newPacket)
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
|
@ -122,7 +139,7 @@ bool stream::addPacket(TCPv4packet *newPacket)
|
|||
if(newPacket->isACK()) // Se c'è ACK setto il flag sul pacchetto corrispondente, se c'è.
|
||||
{
|
||||
|
||||
for (list<TCPv4packet*>::iterator it = buffer[a].begin(); it != buffer[a].end(); it++)
|
||||
for (list<libNetwork::TCPv4packet*>::iterator it = buffer[a].begin(); it != buffer[a].end(); it++)
|
||||
{
|
||||
|
||||
if( (*it)->getSequenceNumber() == newPacket->getAcknowledgmentNumber() - ((*it)->getPayLoad().size()/2))
|
||||
|
@ -154,7 +171,7 @@ void stream::flushBuffer(int number)
|
|||
|
||||
isFound = false;
|
||||
|
||||
for (std::list<TCPv4packet*>::iterator it = buffer[number].begin(); it != buffer[number].end(); it++)
|
||||
for (std::list<libNetwork::TCPv4packet*>::iterator it = buffer[number].begin(); it != buffer[number].end(); it++)
|
||||
{
|
||||
if(sequenceNumber[number] + 1 == (*it)->getSequenceNumber() && (*it)->public_flag)
|
||||
{
|
||||
|
@ -212,7 +229,7 @@ uint64_t stream::getBufferLength()
|
|||
for(int i = 0; i <= 1; i++)
|
||||
{
|
||||
|
||||
for (std::list<TCPv4packet*>::iterator it = buffer[i].begin(); it != buffer[i].end(); it++)
|
||||
for (std::list<libNetwork::TCPv4packet*>::iterator it = buffer[i].begin(); it != buffer[i].end(); it++)
|
||||
{
|
||||
|
||||
bufferlenght += (*it)->getPayloadLength();
|
||||
|
@ -239,12 +256,12 @@ uint32_t stream::getTimeMillis()
|
|||
return timeMillis;
|
||||
}
|
||||
|
||||
mac_address stream::getFirstMacAddress()
|
||||
libNetwork::mac_address stream::getFirstMacAddress()
|
||||
{
|
||||
return macAddress[0];
|
||||
}
|
||||
|
||||
mac_address stream::getSecondMacAddress()
|
||||
libNetwork::mac_address stream::getSecondMacAddress()
|
||||
{
|
||||
return macAddress[1];
|
||||
}
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBPURSUER_H
|
||||
#define LIBPURSUER_H
|
||||
|
@ -31,11 +48,11 @@ private:
|
|||
bool flagFirstFIN;
|
||||
bool flagSecondFIN;
|
||||
|
||||
mac_address macAddress[2];
|
||||
libNetwork::mac_address macAddress[2];
|
||||
boost::asio::ip::address ipAddress[2];
|
||||
uint16_t port[2];
|
||||
|
||||
std::list<TCPv4packet*> buffer[2];
|
||||
std::list<libNetwork::TCPv4packet*> buffer[2];
|
||||
uint32_t sequenceNumber[2];
|
||||
std::string flow[2];
|
||||
|
||||
|
@ -43,17 +60,17 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
bool factory(TCPv4packet *packet);
|
||||
bool factory(libNetwork::TCPv4packet *packet);
|
||||
|
||||
bool addPacket(TCPv4packet *newPacket);
|
||||
bool addPacket(libNetwork::TCPv4packet *newPacket);
|
||||
|
||||
void flushFirstBuffer();
|
||||
void flushSecondBuffer();
|
||||
|
||||
uint64_t getTimeEpoch();
|
||||
uint32_t getTimeMillis();
|
||||
mac_address getFirstMacAddress();
|
||||
mac_address getSecondMacAddress();
|
||||
libNetwork::mac_address getFirstMacAddress();
|
||||
libNetwork::mac_address getSecondMacAddress();
|
||||
boost::asio::ip::address getFirstIpAddress();
|
||||
boost::asio::ip::address getSecondIpAddress();
|
||||
uint16_t getFirstPort();
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include "libRanging.h"
|
||||
|
||||
device::device(mac_address newMac, boost::asio::ip::address newIp, long int newEpoch)
|
||||
device::device(libNetwork::mac_address newMac, boost::asio::ip::address newIp, long int newEpoch)
|
||||
{
|
||||
mac = newMac;
|
||||
ip = newIp;
|
||||
|
@ -24,7 +41,7 @@ boost::asio::ip::address device::getIpAddress()
|
|||
return ip;
|
||||
}
|
||||
|
||||
mac_address device::getMacAddress()
|
||||
libNetwork::mac_address device::getMacAddress()
|
||||
{
|
||||
return mac;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBRANGING_H
|
||||
#define LIBRANGING_H
|
||||
|
@ -18,12 +35,12 @@
|
|||
class device
|
||||
{
|
||||
private:
|
||||
mac_address mac;
|
||||
libNetwork::mac_address mac;
|
||||
boost::asio::ip::address ip;
|
||||
long int timeEpoch;
|
||||
public:
|
||||
device(mac_address newMac, boost::asio::ip::address newIp, long int newEpoch);
|
||||
mac_address getMacAddress();
|
||||
device(libNetwork::mac_address newMac, boost::asio::ip::address newIp, long int newEpoch);
|
||||
libNetwork::mac_address getMacAddress();
|
||||
boost::asio::ip::address getIpAddress();
|
||||
long int getEpoch();
|
||||
void setEpoch(long int newEpoch);
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
//============================================================================
|
||||
// Name : Riddle
|
||||
// Author : Andrea Bontempi
|
||||
// Version : 0.1
|
||||
// Copyright : GNU GPL3
|
||||
// Description : Network Sniffer
|
||||
//
|
||||
// Special Thanks to fede.tft for the big help :-)
|
||||
//
|
||||
//============================================================================
|
||||
/**
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* Name : Project Riddle
|
||||
* Author : Andrea Bontempi
|
||||
* Version : 0.1 aplha
|
||||
* Description : Modular Network Sniffer
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*
|
||||
* This file is part of the project Riddle.
|
||||
*
|
||||
* Foobar is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The project Riddle is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this project. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * -
|
||||
*/
|
||||
|
||||
#ifndef LIBRIDDLE_H
|
||||
#define LIBRIDDLE_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue