[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [gettor/master] Update README and requirements.txt



commit 28f71d534a5594573c736a3576394b01061d9929
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Fri Mar 1 13:49:48 2019 +0100

    Update README and requirements.txt
---
 README.md             | 28 ++++++++++++++++++++++++----
 bin/gettor_service    |  1 +
 requirements.txt      |  6 ++++++
 scripts/process_email | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 sendmail.cfg          |  6 ++++++
 5 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index b922346..d219ba1 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,24 @@ Here is a list of the main goals the new GetTor should accomplish:
  * Language and provider friendly. It should be easy to support new languages
  and to add new providers for storing packages and generate links.
 
+Installing GetTor
+=================
+
+WORKON_HOME=${HOME}/.virtualenvs
+export WORKON_HOME
+mkdir -p $WORKON_HOME
+source $(which virtualenvwrapper.sh)
+git clone https://git.torproject.org/gettor.git && cd gettor
+mkvirtualenv -a $PWD -r requirements.txt --unzip-setuptools --setuptools gettor
+
+From now on, to use BridgeDB's virtualenv, just do ``$ workon gettor``
+(after sourcing virtualenvwrapper.sh, as before). To exit the virtualenv
+without exiting the shell, do ``$ deactivate``.
+
+export PYTHONPATH=$PYTHONPATH:${VIRTUAL_ENV}/lib/python/site-packages
+
+$ ./bin/gettor_service start
+
 
 How does the new GetTor works?
 ==============================
@@ -65,7 +83,10 @@ this:
 --- END FILE ---
 
 You can also check providers/dropbox.links for a better example.
-
+WORKON_HOME=${HOME}/.virtualenvs
+         export WORKON_HOME
+         mkdir -p $WORKON_HOME
+         source $(which virtualenvwrapper.sh)
 *Core*: the heart of GetTor. Receives requests for links for a certain OS and
 language and respond accordingly. It also presents an easy way for scripts
 to create links file.
@@ -86,7 +107,7 @@ if necessary and respond to the user in the specified language. Unfinished.
 to keep count of the number of requests per person and avoid malicious users
 that try to collapse the service. It also keeps count of how many requests
 GetTor has received during its lifetime. A lot of other data was being saved
-in the original gsoc project, but it was changed to save the minimum. 
+in the original gsoc project, but it was changed to save the minimum.
 
 *Blacklist*: Provide a mechanism to avoid flood and deny interaction to
 malicious users.
@@ -119,7 +140,7 @@ should use the trac[0] and select the GetTor component. Some neat ideas we
 could use are the following:
 
  * Report bugs!
- * Create script for new providers, namely: Google Drive, Github. Check 
+ * Create script for new providers, namely: Google Drive, Github. Check
 providers.txt
  * Create a new module for distributing links. Check distribution_methods.txt
  * Finish the Twitter module.
@@ -131,4 +152,3 @@ References
 ===========
 
 [0] https://trac.torproject.org/projects/tor/query?status=accepted&status=assigned&status=needs_information&status=needs_review&status=needs_revision&status=new&status=reopened&component=GetTor&col=id&col=summary&col=component&col=status&col=type&col=priority&col=milestone&order=priority
-
diff --git a/bin/gettor_service b/bin/gettor_service
index 2f7e12a..8b636db 100755
--- a/bin/gettor_service
+++ b/bin/gettor_service
@@ -11,6 +11,7 @@
 # :license: This is Free Software. See LICENSE for license information.
 
 source venv/bin/activate
+alias twistd3="venv/bin/twistd"
 
 case "$1" in
 start)
diff --git a/requirements.txt b/requirements.txt
index e69de29..d639a66 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -0,0 +1,6 @@
+service_identity=18.1.0
+pydkim=0.3
+pyopenssl=19.0.0
+dnspython=1.16.0
+validate_email=1.3
+twisted=18.9.0
diff --git a/scripts/process_email b/scripts/process_email
new file mode 100755
index 0000000..acbefd6
--- /dev/null
+++ b/scripts/process_email
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# This file is part of GetTor, a Tor Browser distribution system.
+#
+# :authors: isra <ilv@xxxxxxxxxxxxxx>
+#           see also AUTHORS file
+#
+# :license: This is Free Software. See LICENSE for license information.
+
+import sys
+sys.path.insert(0, '..')
+
+from twisted.python import log
+from twisted.internet import defer, reactor
+
+from gettor import EMAIL_PARSER_LOGFILE
+from gettor.parse.email import EmailParser, AddressError, DKIMError
+
+@defer.inlineCallbacks
+def process_email(message):
+
+    try:
+        ep = EmailParser("gettor+test@xxxxxxxxxxxxxx")
+        yield defer.maybeDeferred(
+            ep.parse, message
+        ).addCallback(ep.parse_callback).addErrback(ep.parse_errback)
+
+    except AddressError as e:
+            log.err("Address error: {}".format(e), system="process email")
+            reactor.stop()
+
+    except DKIMError as e:
+            log.err("DKIM error: {}".format(e), system="process email")
+            reactor.stop()
+
+    reactor.stop()
+
+def main():
+    incoming_email = sys.stdin.read()
+    reactor.callWhenRunning(process_email, incoming_email)
+    reactor.run()
+
+
+if __name__ == '__main__':
+    log.startLogging(open(EMAIL_PARSER_LOGFILE, 'a'))
+    log.msg("New email request received.", system="process email")
+    main()
+    log.msg("Email request processed.", system="process email")
diff --git a/sendmail.cfg b/sendmail.cfg
new file mode 100644
index 0000000..90678d8
--- /dev/null
+++ b/sendmail.cfg
@@ -0,0 +1,6 @@
+[credentials]
+addr: gettor+test@xxxxxxxxxxxxxx
+
+[general]
+interval: 10
+max_help_requests: 10



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits