#!/usr/local/bin/python2
from scapy.all import *
os.system("iptables -A OUTPUT -p tcp -o eth0 --sport 1:65535 --tcp-flags RST RST -j DROP")
def packet(pkt):
if pkt[TCP].flags == 2:
print('SYN packet detected port : ' + str(pkt[TCP].sport) + ' from IP Src : ' + pkt[IP].src)
send(IP(dst=pkt[IP].src, src=pkt[IP].dst)/TCP(dport=pkt[TCP].sport, sport=pkt[TCP].dport,ack=pkt[TCP].seq + 1, flags='SA'))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(gdb) bt 15 | |
#0 0x00007ffff79bd32c in ?? () from /usr/lib/libc.so.6 | |
#1 0x00007ffff796c6c8 in raise () from /usr/lib/libc.so.6 | |
#2 0x00007ffff79544b8 in abort () from /usr/lib/libc.so.6 | |
#3 0x00007ffff7c9ca6f in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95 | |
#4 0x00007ffff7cb011c in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48 | |
#5 0x00007ffff7cb0189 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58 | |
#6 0x00007ffff7cb03ed in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x5555555ba4b8 <typeinfo for boost::wrapexcept<boost::multi_index::detail::bad_archive_exception>>, | |
dest=0x55555557c240 <boost::wrapexcept<boost::multi_index::detail::bad_archive_exception>::~wrapexcept()>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98 | |
#7 0x000055555557c33e in boost::throw_exception<boost::multi_index::detail::bad_archive_excep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2017-08-25T22:40:16 | |
# | |
#------------------------------------------------- | |
CONFIG += c++11 | |
QT += core gui quick qml location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2017-08-25T22:40:16 | |
# | |
#------------------------------------------------- | |
CONFIG += c++11 | |
QT += core gui quick qml location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PORT = 6798; | |
var HOST = '0.0.0.0'; | |
var dgram = require('dgram'); | |
var request = require('request'); | |
var server = dgram.createSocket('udp4'); | |
server.on('listening', function () { | |
var address = server.address(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_PCI_DOMAIN_NUM 0x0001 | |
#define MY_PCI_BUS_NUM 0x00 | |
#include <linux/pci.h> | |
#include <linux/kernel.h> | |
#include <linux/types.h> | |
#include <linux/init.h> | |
#include <linux/module.h> | |
#include <linux/pci-ats.h> | |
#include <linux/pci-acpi.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I know the thread is old. But I have to create a fake PCI device with custom read/write function. I am trying to replicate this example and hitting errors. Can you please post an working demo ? | |
I was getting compilation errors on [CODE]struct pci_bus my_pci_bus = NULL;[/CODE] so I changed that to [CODE]struct pci_bus my_pci_bus = {};[/CODE] | |
This is my current code | |
[CODE]#define MY_PCI_DOMAIN_NUM 0x0001 | |
#define MY_PCI_BUS_NUM 0x00 | |
#include <linux/pci.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string buffer; | |
std::copy(_packet.body(), _packet.body()+_packet.payload_size(), buffer.begin()); | |
const char* buff = buffer.c_str(); | |
const char* i = buff; | |
boost::uint32_t address_size = *reinterpret_cast<const boost::uint32_t*>(i); | |
i += sizeof(boost::uint32_t); | |
std::string address; | |
std::copy(i, i+address_size, address.begin()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct A{ | |
void f(){ | |
std::cout << "A" << std::endl; | |
} | |
}; | |
struct B: public virtual A{ | |
void f(){ | |
std::cout << "B" << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct A{ | |
void f(){ | |
std::cout << "A" << std::endl; | |
} | |
}; | |
struct B: public virtual A{ | |
void f(){ | |
std::cout << "B" << std::endl; |
NewerOlder