Permalink
Browse files

Configuration File! v0.1.1a

  • Loading branch information...
1 parent f07f23a commit ce106625772553bb74169cb419c8dfde64a667c4 @integgroll committed Jan 26, 2012
Showing with 75 additions and 20 deletions.
  1. +2 −3 whacker.py
  2. +1 −1 wharf.py
  3. +34 −0 wharfwhacker.conf
  4. +38 −16 wharfwhacker.py
View
@@ -2,10 +2,9 @@
from wharfwhacker import Whacker
import socket
-ip_address = "172.16.2.158"
-whacker = Whacker("172.16.2.128","1234",[22,6667,4444],[80,443],5)
+whacker = Whacker()
-whacker.whack(ip_address)
+whacker.whack("127.0.0.1")
#s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#s.sendto("are those pants?",(ip_address,18))
View
@@ -4,5 +4,5 @@
#Syntax for use of WharfWhacker server
# WharfWhacker(local IP address, password for connecting, array of ports in use, number of knocks needed for verification)
-port_authority = WharfWhacker("172.16.2.158","1234",[22,6667],[443,80],5)
+port_authority = WharfWhacker()
port_authority.start()
View
@@ -0,0 +1,34 @@
+### Oh Mister WharfWhacker config file, please teach me how to whack wharfs.
+## Why of course lovely lady, I whack my wharf all the time.
+
+## First off you gotta declare which wharf you want to make whackable.
+### Sounds hard
+## It is baby, it is, but to set that up you just do something like this.
+server_address: 127.0.0.1
+
+### Oh that is really hard
+## You know it, step two is to tell it what the saftey word is
+## whatever you do though don't recycle saftey words, that's dangerous
+password: banana
+
+### What do I do now you man beast you
+## Now you want to tell me what ports you want me to protect
+protect_ports: 22,6667,4444
+
+### Yeah you protect those ports, but whatever you do don't touch these ports
+## Just tell me which ones those are here
+ignore_ports: 80,443
+
+## Finally, you just gotta tell me two more things
+### What is that WW I'll tell you anything
+## Tell me how many times you want me to whack
+knocks: 5
+
+## Finally tell me where you are knocking from
+local_ip: 127.0.0.1
+
+### Wow WW you do whack ports really well, do it again.
+## I can't baby, I am all whacked out.
+
+
+
View
@@ -5,18 +5,31 @@
import sys
import subprocess
import hashlib
+import re
+import os
from time import strftime, gmtime, sleep
from Queue import Queue
from threading import Thread
class WharfWhacker:
- def __init__(self,ip_address,password,secured_ports,safe_ports,authentication_length):
- self.ip_address = ip_address
- self.password = password
- self.secured_ports = secured_ports
- self.safe_ports = safe_ports
- self.ignore_ports = secured_ports + safe_ports
- self.authentication_length = authentication_length
+ def __init__(self):
+ attributes = dict()
+
+ if os.path.isfile("wharfwhacker.conf"):
+ conf = file("wharfwhacker.conf","r").readlines()
+ for line in conf:
+ line = line.rstrip()
+ if len(line)>0:
+ if line[0] not in ["\n","#"]:
+ temp = line.split(":")
+ attributes[temp[0]] = temp[1].lstrip()
+
+ self.ip_address = attributes['server_address']
+ self.password = attributes['password']
+ self.secured_ports = attributes['protect_ports'].split(",")
+ self.safe_ports = attributes['ignore_ports'].split(",")
+ self.ignore_ports = self.secured_ports + self.safe_ports
+ self.authentication_length = int(attributes['knocks'])
self.start_port = 0
self.reserved_pool = ThreadPool(self.authentication_length*10+1)
self.connection_sockets = []
@@ -126,17 +139,26 @@ def add_iptable_rule(self,rule):
class Whacker():
- def __init__(self,ip_address,password,secured_ports,safe_ports,authentication_length):
- self.password = password
- self.authentication_length = authentication_length
- self.secured_ports = secured_ports
- self.safe_ports = safe_ports
- self.ignore_ports = secured_ports + safe_ports
+ def __init__(self):
+ attributes = dict()
+ if os.path.isfile("wharfwhacker.conf"):
+ conf = file("wharfwhacker.conf","r").readlines()
+ for line in conf:
+ line = line.rstrip()
+ if len(line)>0:
+ if line[0] not in ["\n","#"]:
+ temp = line.split(":")
+ attributes[temp[0]] = temp[1].lstrip()
+ self.ip_address = attributes['local_ip']
+ self.password = attributes['password']
+ self.secured_ports = attributes['protect_ports'].split(",")
+ self.safe_ports = attributes['ignore_ports'].split(",")
+ self.authentication_length = int(attributes['knocks'])
+ self.ignore_ports = self.secured_ports + self.safe_ports
self.ports = []
- self.ip_address = ip_address
- self.generate_ports()
def whack(self,target_ip):
+ self.generate_ports()
# Runs a knock against target server
for i in self.ports:
#print i
@@ -163,7 +185,7 @@ def generate_ports(self):
temp_port = int(porthash[x:x+4],16)
if temp_port > 1024 and temp_port not in self.ignore_ports:
self.ports.append(temp_port)
- x = x + 5
+ x = x + 5
#Whacker Class is ended here
#The following four classes are all part of the setup so that the other things can run happily.

0 comments on commit ce10662

Please sign in to comment.