Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update build script. Push to FTP rather than GitHub now.

  • Loading branch information...
commit ca9863d88c904e4ec3f0762782f7a7412e5c77aa 1 parent ff10b7f
@mhils authored
View
2  .gitignore
@@ -5,4 +5,4 @@ outfile
dump/
build/dojo/
web/build/
-build/github_oauth_token.txt
+build/ftp_config.json
View
4 README.md
@@ -21,11 +21,11 @@ We love to hear from your experience with HoneyProxy. If you have any feature su
## Quick start
-Download the [**latest release**](https://github.com/downloads/mhils/HoneyProxy/honeyproxy-latest.zip) or clone the git repo: `git clone --recursive git://github.com/mhils/HoneyProxy.git`.
+Download the [**latest release**](http://honeyproxy.org/download/honeyproxy-latest.zip), a [development snapshot](http://honeyproxy.org/download.html) or clone the git repo: `git clone --recursive git://github.com/mhils/HoneyProxy.git`.
**Install all dependencies**: `pip install pyOpenSSL pyasn1 Twisted Autobahn`
Windows users: Install the binaries for [pyOpenSSL](http://pypi.python.org/pypi/pyOpenSSL) and [Twisted](http://twistedmatrix.com/trac/wiki/Downloads) manually.
-Ubuntu / Debian users: Install twisted as package (sudo apt-get install python-twisted)
+Ubuntu / Debian users: Install twisted as a package (sudo apt-get install python-twisted)
**Start HoneyProxy** with `python honeyproxy.py` or `python honeyproxy.py --help`.
If you don't use a modern browser, a kitten will die. We currently support both Firefox and Chrome!
View
3,849 build/cacert.pem
0 additions, 3,849 deletions not shown
View
89 build/deploy-snapshot.py
@@ -1,71 +1,44 @@
-import os.path, urllib, pycurl as curl, cStringIO, json
+import os.path, json, ftplib
from datetime import date
-config = {
- "user": "mhils",
- "repo": "HoneyProxy"
-}
+
filename = "snapshot-%(date)s.zip" % {"date": date.today().strftime("%Y%m%d")}
filepath = os.path.abspath("../dist/"+filename)
print "File Path: "+str(filepath)
assert os.path.isfile(filepath)
filesize = os.path.getsize(filepath)
-def common_curl_options(c):
-
- c.setopt(curl.CAINFO, os.path.abspath("cacert.pem"))
- c.setopt(curl.FAILONERROR, True)
- #c.setopt(curl.VERBOSE, True)
- #c.setopt(curl.SSL_VERIFYPEER, 0)
- #c.setopt(curl.SSL_VERIFYHOST, 0)
- #c.setopt(curl.PROXY, 'http://localhost:8080')
+with open("ftp_config.json","r") as f:
+ config = json.loads(f.read())
-buf = cStringIO.StringIO()
-c = curl.Curl()
-common_curl_options(c)
-c.setopt(curl.URL, 'https://api.github.com/repos/%(user)s/%(repo)s/downloads' % config)
-c.setopt(curl.WRITEFUNCTION, buf.write)
+print "Connecting..."
-with open("github_oauth_token.txt","r") as f:
- c.setopt(curl.HTTPHEADER, ['Authorization: token ' + f.read()])
+ftp = ftplib.FTP()
+ftp.connect(config["host"], config["port"])
-params = {"name":filename, "size":filesize}
-c.setopt(curl.POSTFIELDS,json.dumps(params))
-print "Create Download @ GitHub..."
-c.perform()
-data = json.loads(buf.getvalue())
-buf.close()
-c.close()
-print "Download created."
+ftp.login(config["user"],config["password"])
+
+ftp.cwd(config["uploaddir"])
-#s3 upload
-c = curl.Curl()
-common_curl_options(c)
-c.setopt(curl.URL,str(data.get("s3_url")))
-class ProgressDisplay:
- last_progress = -1
- def progress(self,download_t, download_d, upload_t, upload_d):
- if(upload_t > 0):
- progress = int(100 * upload_d / upload_t)
- if(progress - self.last_progress > 0):
- print "%02d%%" % progress
- self.last_progress = progress
-
-c.setopt(c.NOPROGRESS, 0)
-c.setopt(curl.WRITEFUNCTION, cStringIO.StringIO().write)
-c.setopt(curl.PROGRESSFUNCTION, ProgressDisplay().progress)
-values = [
- ("key", str(data.get("path"))),
- ("acl",str(data.get("acl"))),
- ("success_action_status","201"),
- ("Filename",str(data.get("name"))),
- ("AWSAccessKeyId",str(data.get("accesskeyid"))),
- ("Policy",str(data.get("policy"))),
- ("Signature",str(data.get("signature"))),
- ("Content-Type",str(data.get("mime_type"))),
- ("file", (curl.FORM_FILE, filepath))
-]
-c.setopt(curl.HTTPPOST, values)
print "Start Upload..."
-c.perform()
-c.close()
+
+done = float(0)
+percent = 0
+def progress(x):
+ global done, percent
+ done += len(x)
+ currPercent = round(100*(done / filesize))
+ if currPercent > percent:
+ percent = currPercent
+ print "%3d%%" % currPercent
+
+with open(filepath,"rb") as snapshotf:
+
+ #just try to delete the file
+ try:
+ ftp.delete(filename)
+ except ftplib.error_perm:
+ pass
+ #and upload...
+ ftp.storbinary("STOR %s" % filename, snapshotf, callback=progress)
+
print "Finished!"
View
7 build/ftp_config.json.example
@@ -0,0 +1,7 @@
+{
+ "host":"example.com",
+ "port":21,
+ "uploaddir":"/download",
+ "user":"user",
+ "password":"42"
+}
View
22 build/github-auth.py
@@ -1,22 +0,0 @@
-import urllib2, json, getpass, base64
-
-username = raw_input("User:")
-password = getpass.getpass("Password:")
-
-params = {"scopes":["repo"],"note":"download-deploy"}
-request = urllib2.Request(
- url="https://api.github.com/authorizations",
- data=json.dumps(params))
-#basic auth
-base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
-request.add_header("Authorization", "Basic %s" % base64string)
-
-result = urllib2.urlopen(request)
-
-token = json.loads(result.read()).get("token")
-
-with open("github_oauth_token.txt","w") as f:
- f.write(token)
-
-print "Token saved to github_oauth_token.txt!"
-raw_input("Press any key to continue...")
Please sign in to comment.
Something went wrong with that request. Please try again.