Code refactoring + port-hijacking backend (need port-hijacking backend testing)+
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from ast import Delete
|
||||
import asyncio
|
||||
from typing import Dict
|
||||
from modules.porthijack.nftables import FiregexTables, FiregexFilter
|
||||
from modules.porthijack.nftables import FiregexTables
|
||||
from modules.porthijack.models import Service
|
||||
from utils.sqlite import SQLite
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ class FiregexTables(NFTableManager):
|
||||
target=filter["chain"],
|
||||
id=int(filter["handle"]),
|
||||
proto=filter["expr"][1]["match"]["left"]["payload"]["protocol"],
|
||||
public_port=filter["expr"][1]["match"]["right"] if filter["target"] == self.prerouting_porthijack else filter["expr"][2]["mangle"]["value"],
|
||||
proxy_port=filter["expr"][1]["match"]["right"] if filter["target"] == self.postrouting_porthijack else filter["expr"][2]["mangle"]["value"],
|
||||
public_port=filter["expr"][1]["match"]["right"] if filter["chain"] == self.prerouting_porthijack else filter["expr"][2]["mangle"]["value"],
|
||||
proxy_port=filter["expr"][1]["match"]["right"] if filter["chain"] == self.postrouting_porthijack else filter["expr"][2]["mangle"]["value"],
|
||||
ip_int=ip_int
|
||||
))
|
||||
return res
|
||||
|
||||
@@ -41,8 +41,8 @@ db = SQLite('db/port-hijacking.db', {
|
||||
'services': {
|
||||
'service_id': 'VARCHAR(100) PRIMARY KEY',
|
||||
'active' : 'BOOLEAN NOT NULL CHECK (active IN (0, 1))',
|
||||
'public_port': 'INT NOT NULL CHECK(port > 0 and port < 65536)',
|
||||
'proxy_port': 'INT NOT NULL CHECK(port > 0 and port < 65536)',
|
||||
'public_port': 'INT NOT NULL CHECK(public_port > 0 and public_port < 65536)',
|
||||
'proxy_port': 'INT NOT NULL CHECK(proxy_port > 0 and proxy_port < 65536)',
|
||||
'name': 'VARCHAR(100) NOT NULL UNIQUE',
|
||||
'proto': 'VARCHAR(3) NOT NULL CHECK (proto IN ("tcp", "udp"))',
|
||||
'ip_int': 'VARCHAR(100) NOT NULL',
|
||||
|
||||
Reference in New Issue
Block a user