mirror of https://github.com/fmartingr/iosfu.git
Initial project structure
This commit is contained in:
parent
88b5622ebb
commit
5ffa54866b
|
@ -34,3 +34,6 @@ nosetests.xml
|
||||||
.mr.developer.cfg
|
.mr.developer.cfg
|
||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
|
|
||||||
|
# Virtualenv
|
||||||
|
.virtualenv
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
- "3.3"
|
||||||
|
script: "python -m unittest discover"
|
|
@ -0,0 +1 @@
|
||||||
|
include requirements.txt
|
|
@ -0,0 +1,5 @@
|
||||||
|
clean:
|
||||||
|
find . -name __pycache__ | grep -v .virtualenv | xargs rm -rf
|
||||||
|
|
||||||
|
tests:
|
||||||
|
python -m unittest
|
|
@ -0,0 +1 @@
|
||||||
|
__version__ = '0.0.0'
|
|
@ -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()
|
|
@ -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)
|
||||||
|
)
|
|
@ -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.'
|
|
@ -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.'
|
|
@ -0,0 +1,9 @@
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def slugify(string):
|
||||||
|
"""
|
||||||
|
Slugify strings
|
||||||
|
"""
|
||||||
|
string = string.lower()
|
||||||
|
return re.sub(r'\W+', '-', string)
|
|
@ -0,0 +1 @@
|
||||||
|
Flask==0.10.1
|
|
@ -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,0 +1,10 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
class Dummy(unittest.TestCase):
|
||||||
|
def test_sum(self):
|
||||||
|
self.assertTrue(True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
|
@ -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()
|
Loading…
Reference in New Issue