Initial project structure

This commit is contained in:
Felipe Martín 2013-11-18 18:42:25 +01:00
parent 88b5622ebb
commit 5ffa54866b
19 changed files with 193 additions and 0 deletions

3
.gitignore vendored
View File

@ -34,3 +34,6 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject
# Virtualenv
.virtualenv

5
.travis.yml Normal file
View File

@ -0,0 +1,5 @@
language: python
python:
- "2.7"
- "3.3"
script: "python -m unittest discover"

1
MANIFEST.in Normal file
View File

@ -0,0 +1 @@
include requirements.txt

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
clean:
find . -name __pycache__ | grep -v .virtualenv | xargs rm -rf
tests:
python -m unittest

1
iosfu/__init__.py Normal file
View File

@ -0,0 +1 @@
__version__ = '0.0.0'

0
iosfu/gui/__init__.py Normal file
View File

21
iosfu/gui/app.py Normal file
View File

@ -0,0 +1,21 @@
from flask import Flask
from os import getcwd
from os.path import dirname, realpath
PWD = getcwd()
MODULE_PATH = dirname(realpath(__file__))
app = Flask(__name__)
@app.route("/")
def main():
result = """
Executed from: {0}<br />
Path for GUI module: {1}
""".format(PWD, MODULE_PATH)
return result
if __name__ == "__main__":
app.run()

37
iosfu/plugin/__init__.py Normal file
View File

@ -0,0 +1,37 @@
from iosfu.utils import slugify
class Library(object):
_instance = None
plugins = {} # Plugin dictonary
def register(self, plugin):
"""
Decorator to register plugins
"""
ins = plugin()
plugin_slug = ins.__slug__
if ins not in self.plugins:
self.plugins[plugin_slug] = plugin
else:
raise RuntimeError(
'Plugin {0} already registered.'.format(plugin_slug))
class BasePlugin(object):
"""
Base plugin object
"""
category = 'Base'
name = 'Base Plugin'
description = ''
@property
def __slug__(self):
"""
Returns slugified name for identification
"""
return u"{0}.{1}".format(
slugify(self.category),
slugify(self.name)
)

View File

View File

@ -0,0 +1,11 @@
from iosfu.plugin import BasePlugin, Library
plugin_library = Library()
@plugin_library.register
class ContactsPlugin(BasePlugin):
category = 'Base'
name = 'Contacts'
description = 'Contacts.'

View File

View File

@ -0,0 +1,11 @@
from iosfu.plugin import BasePlugin, Library
plugin_library = Library()
@plugin_library.register
class PhotosPlugin(BasePlugin):
category = 'Base'
name = 'Photos'
description = 'Photos.'

9
iosfu/utils.py Normal file
View File

@ -0,0 +1,9 @@
import re
def slugify(string):
"""
Slugify strings
"""
string = string.lower()
return re.sub(r'\W+', '-', string)

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Flask==0.10.1

53
setup.py Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re
import os
import sys
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search(
"^__version__ = ['\"]([^'\"]+)['\"]",
init_py, re.MULTILINE).group(1)
package = 'iosfu'
version = get_version(package)
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist upload")
args = {'version': version}
print("You probably want to also tag the version now:")
print(" git tag -a %(version)s -m 'version %(version)s'" % args)
print(" git push --tags")
sys.exit()
setup(
name='iosfu',
version=version,
url='http://github.com/fmartingr/iosfu',
license='MIT',
description='iOS Forensics Utility',
author='Felipe Martin',
author_email='fmartingr@me.com',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=open('requirements.txt').read().split('\n'),
classifiers=[
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Intended Audience :: Other Audience'
'Operating System :: OS Independent',
'Programming Language :: Python ;; 2.7',
'Programming Language :: Python ;; 3.3',
'Topic :: Security',
]
)

0
tests/__init__.py Normal file
View File

10
tests/test_dummy.py Normal file
View File

@ -0,0 +1,10 @@
import unittest
class Dummy(unittest.TestCase):
def test_sum(self):
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,13 @@
import unittest
class PluginControllerTests(unittest.TestCase):
def test_find_packages(self):
pass
def test_load_package(self):
pass
if __name__ == '__main__':
unittest.main()

12
tox.ini Normal file
View File

@ -0,0 +1,12 @@
[tox]
envlist = py27, py33
[testenv:py33]
commands = python -m unittest
[testenv:py27]
commands = python -m unittest discover
[testenv]
deps =
-r{toxinidir}/requirements.txt