Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
Code cleanup with extra functionalities added
  • Loading branch information
subho007 committed Jan 6, 2013
1 parent 9a49398 commit 4fe58d7
Show file tree
Hide file tree
Showing 77 changed files with 21,781 additions and 272 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
AFE
===

Android Framework for Exploitation, is a framework for exploiting android based devices and applications.
Detailed documentation will be uploaded soon.
Android Framework for Exploitation, is a framework for exploiting android based devices

By XYSEC Labs
(http://xysec.com)

For futher enquiry, please mail us at [email protected]
---------------------------------------
This Framework will be launching soon !
---------------------------------------
86 changes: 0 additions & 86 deletions internals/lib/basecmd.py

This file was deleted.

153 changes: 148 additions & 5 deletions internals/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,154 @@
#AFE Version
version = "2.0"

import SimpleHTTPServer
import time
import SocketServer
import logging
import cgi
import SimpleHTTPServer, time, SocketServer, logging, cgi, os, cmd, socket, sys, urllib2

class COLOR:
WHITE = '\033[37m'
GRAY = '\033[30m'
BLUE = '\033[34m'
GREEN = '\033[92m'
YELLOW = '\033[33m'
RED = '\033[91m'
ENDC = '\033[1;m'

class Server:
"""Server class"""

def __init__(self, ip, port, direction):
self.ip = ip
self.port = port
self.direction = direction
self.socketConn = None

def __del__(self):
try:
self.socketConn.close()
except Exception:
pass

def connectSocket(self):
try:
self.socketConn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socketConn.connect((self.ip, self.port))
return True
except socket.error:
return False

def sendData(self, data):
self.connectSocket()
self.socketConn.sendall(data)

def receiveData(self):
return self.socketConn.recv(2048)

def closeSocket(self):
self.socketConn.close()
self.socketConn = None




class BaseCmd(cmd.Cmd):

def __init__(self, session):
cmd.Cmd.__init__(self)
self.ruler = "-"
self.doc_header = "Commands - type help <command> for more info"
self.session = session
self._hist = [] ## No history yet
self._locals = {} ## Initialize execution namespace for user
self._globals = {}
self.cmdline = None

## Command definitions to support Cmd object functionality ##
def do_help(self, args):
"""
Get help on commands
'help' or '?' with no arguments prints a list of commands for which help is available
'help <command>' or '? <command>' gives help on <command>
"""
## The only reason to define this method is for the help text in the doc string
cmd.Cmd.do_help(self, args)

## Override methods in Cmd object ##
def preloop(self):
"""
Initialization before prompting user for commands.
Despite the claims in the Cmd documentaion, Cmd.preloop() is not a stub.
"""
cmd.Cmd.preloop(self) ## sets up command completion
self._hist = [] ## No history yet
self._locals = {} ## Initialize execution namespace for user
self._globals = {}

def postloop(self):
"""
Take care of any unfinished business.
Despite the claims in the Cmd documentaion, Cmd.postloop() is not a stub.
"""
cmd.Cmd.postloop(self) ## Clean up command completion

def precmd(self, line):
"""
This method is called after the line has been input but before
it has been interpreted. If you want to modifdy the input line
before execution (for example, variable substitution) do it here.
"""
self._hist += [ line.strip() ]
return line

def postcmd(self, stop, line):
"""
If you want to stop the console, return something that evaluates to true.
If you want to do some post command processing, do it here.
"""
return stop


def emptyline(self):
"""
Do nothing on empty input line
"""
pass

def default(self, line):
"""
Called on an input line when the command prefix is not recognized.
"""
print "Command not found\n"

def do_shell(self, args):
"""Pass command to a system shell when line begins with '!'"""
os.system(args)

def do_clear(self, line):
"""
This command clears the screen or the terminal window!
"""
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')

def do_exit(self, line):
"""
This command exits to the terminal window!
"""
sys.exit(0)

class Logger(object):
def __init__(self, filename):
self.terminal = sys.stdout
self.log = open(filename, "a")

def __del__(self):
self.log.close()

def write(self, message):
self.terminal.write(message)
self.log.write(message)


class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):

Expand Down
Binary file modified internals/lib/common.pyc
Binary file not shown.
19 changes: 0 additions & 19 deletions internals/lib/list.py

This file was deleted.

18 changes: 6 additions & 12 deletions internals/lib/menu.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/usr/bin/python
#
# License: Refer to the README in the root directory
#
import argparse, shlex, sys, urllib2
from basecmd import BaseCmd

import argparse, shlex, sys, urllib2, time, SocketServer
from common import BaseCmd, Server, version, ServerHandler
from subprocess import call
from modules import Modules
from server import Server
from common import version, ServerHandler
import time
import SocketServer
import logging
import cgi


class Menu(BaseCmd):

Expand Down Expand Up @@ -69,7 +62,7 @@ def do_query(self, args):
resp = self.session.receiveData()
print resp
else:
print "**Not connected to the SERVER App !"
print "**Not connected to the AFE SERVER App !"
except:
pass
def do_serve(self, args):
Expand All @@ -86,6 +79,7 @@ def do_serve(self, args):
PORT = int(splitargs.port)
else:
PORT = 8080

Handler = ServerHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port ", PORT
Expand Down
Binary file modified internals/lib/menu.pyc
Binary file not shown.
Binary file modified internals/lib/modules.pyc
Binary file not shown.
42 changes: 0 additions & 42 deletions internals/lib/server.py

This file was deleted.

30 changes: 0 additions & 30 deletions internals/malware/bin/AndroidManifest.xml

This file was deleted.

2 changes: 0 additions & 2 deletions internals/malware/bin/AndroidManifest.xml.d

This file was deleted.

Loading

0 comments on commit 4fe58d7

Please sign in to comment.