-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-// cisco.tierra@gmail.com
-
-// Standard
+// ANNA - Anna is Not Nothingness Anymore //
+// //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
+// //
+// See project site at http://redmine.teslayout.com/projects/anna-suite //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
#include <pcap.h>
#include <stdlib.h>
#include <netinet/ip.h>
#include <map>
#include <anna/core/DataBlock.hpp>
-#include <anna/core/util/Tokenizer.hpp>
#include <anna/core/functions.hpp>
#include <anna/core/tracing/Logger.hpp>
#include <anna/core/tracing/TraceWriter.hpp>
}
}
- void setSourceIP(const std::string &srcIP) throw() {
+ void setSourceIP(const std::string &srcIP) {
_sourceIP = srcIP;
}
- void setDestinationIP(const std::string &dstIP) throw() {
+ void setDestinationIP(const std::string &dstIP) {
_destinationIP = dstIP;
}
- void setTimestamp(time_t ts) throw() {
+ void setTimestamp(time_t ts) {
_timestamp = ts;
}
- void setTimestampU(int tsu) throw() {
+ void setTimestampU(int tsu) {
_timestampU = tsu;
}
// Returns true if completed:
- bool appendData(const char *data, size_t size) throw(RuntimeException) {
+ bool appendData(const char *data, size_t size) noexcept(false) {
LOGDEBUG(
Logger::debug(anna::functions::asString("Appending %d bytes", size), ANNA_FILE_LOCATION));
_data.append(data, size);
return true;
}
- void reset() throw() {
+ void reset() {
_sourceIP = "";
_destinationIP = "";
_timestamp = 0;
_diameterLength = -1; // not calculated yet
}
- const std::string &getSourceIP() const throw() {
+ const std::string &getSourceIP() const {
return _sourceIP;
}
- const std::string &getDestinationIP() const throw() {
+ const std::string &getDestinationIP() const {
return _destinationIP;
}
- time_t getTimestamp() const throw() {
+ time_t getTimestamp() const {
return _timestamp;
}
- int getTimestampU() const throw() {
+ int getTimestampU() const {
return _timestampU;
}
- const std::string &getData() const throw() {
+ const std::string &getData() const {
return _data;
}
- std::string getDataAsHex() const throw() {
+ std::string getDataAsHex() const {
return anna::functions::asHexString(
anna::DataBlock(_data.c_str(), _data.size()));
}
u_char *getPayload(const u_char* packet, int packetSize, int &payloadSize,
std::string &srcIp, std::string &dstIp, int &fragmentId, bool &dfFlag,
bool &mfFlag, int &fragmentOffset) {
- const struct sniff_ethernet *ethernet; /* The ethernet header */
const struct sniff_ip *ip; /* The IP header */
const struct sniff_tcp *tcp; /* The TCP header */
u_int size_ip;
u_int size_tcp;
- ethernet = (struct sniff_ethernet*)(packet);
ip = (struct sniff_ip*)(packet + SIZE_ETHERNET);
size_ip = IP_HL(ip) * 4; // 4 bytes per 32 bits word
count++;
}
-bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) throw() {
+bool getDataBlockFromHexFile(const std::string &pathfile, anna::DataBlock &db) {
// Get hex string
static char buffer[8192];
std::ifstream infile(pathfile.c_str(), std::ifstream::in);
// Command-line parameters:
std::string inputFile = argv[1];
- bool isHex = (inputFile.substr(inputFile.find_last_of(".") + 1) == "hex");
+ //bool isHex = (inputFile.substr(inputFile.find_last_of(".") + 1) == "hex");
std::string outputFile = inputFile; // extension will be added later
std::string optionals;
int indx = 2;
// SNIFFING //////////////////////////////////////////////////////////////////////////////////////////////7
//temporary packet buffers
- struct pcap_pkthdr header; // The header that pcap gives us
- const u_char *packet; // The actual packet
+ //struct pcap_pkthdr header; // The header that pcap gives us
+ //const u_char *packet; // The actual packet
//------------------
//open the pcap file
pcap_t *handle;