diff --git a/.gitignore b/.gitignore index ded6067..dfc0905 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +# Virtualenv +.virtualenv diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..571fd59 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: python +python: + - "2.7" + - "3.3" +script: "python -m unittest discover" diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f9bd145 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include requirements.txt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f8caff1 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +clean: + find . -name __pycache__ | grep -v .virtualenv | xargs rm -rf + +tests: + python -m unittest diff --git a/iosfu/__init__.py b/iosfu/__init__.py new file mode 100644 index 0000000..c57bfd5 --- /dev/null +++ b/iosfu/__init__.py @@ -0,0 +1 @@ +__version__ = '0.0.0' diff --git a/iosfu/gui/__init__.py b/iosfu/gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/iosfu/gui/app.py b/iosfu/gui/app.py new file mode 100644 index 0000000..15d061b --- /dev/null +++ b/iosfu/gui/app.py @@ -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}
+ Path for GUI module: {1} + """.format(PWD, MODULE_PATH) + return result + +if __name__ == "__main__": + app.run() diff --git a/iosfu/plugin/__init__.py b/iosfu/plugin/__init__.py new file mode 100644 index 0000000..6bfdf67 --- /dev/null +++ b/iosfu/plugin/__init__.py @@ -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) + ) diff --git a/iosfu/plugin/contacts/__init__.py b/iosfu/plugin/contacts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/iosfu/plugin/contacts/plugin.py b/iosfu/plugin/contacts/plugin.py new file mode 100644 index 0000000..1010ed7 --- /dev/null +++ b/iosfu/plugin/contacts/plugin.py @@ -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.' diff --git a/iosfu/plugin/photos/__init__.py b/iosfu/plugin/photos/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/iosfu/plugin/photos/plugin.py b/iosfu/plugin/photos/plugin.py new file mode 100644 index 0000000..a5f955c --- /dev/null +++ b/iosfu/plugin/photos/plugin.py @@ -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.' diff --git a/iosfu/utils.py b/iosfu/utils.py new file mode 100644 index 0000000..489106f --- /dev/null +++ b/iosfu/utils.py @@ -0,0 +1,9 @@ +import re + + +def slugify(string): + """ + Slugify strings + """ + string = string.lower() + return re.sub(r'\W+', '-', string) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..632a1ef --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask==0.10.1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..4003583 --- /dev/null +++ b/setup.py @@ -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', + ] +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_dummy.py b/tests/test_dummy.py new file mode 100644 index 0000000..f0b28a4 --- /dev/null +++ b/tests/test_dummy.py @@ -0,0 +1,10 @@ +import unittest + + +class Dummy(unittest.TestCase): + def test_sum(self): + self.assertTrue(True) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_plugin_controller.py b/tests/test_plugin_controller.py new file mode 100644 index 0000000..8cfc561 --- /dev/null +++ b/tests/test_plugin_controller.py @@ -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() diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..daf4f89 --- /dev/null +++ b/tox.ini @@ -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