Commit 9b76daba authored by Hiro's avatar Hiro 🏄
Browse files

Merge refactoring work from Hiro

parents ece5dfe5 98862a5f
#!/bin/bash
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: Hiro <hiro@torproject.org>
# see also AUTHORS file
#
# :copyright: (c) 2008-2019, The Tor Project, Inc.
#
# :license: This is Free Software. See LICENSE for license information.
cd ;
virtualenv gettor/venv
source gettor/venv/bin/activate
python3 gettor/scripts/check_service $1
# store exit status
status=$?
if test $status -ne 0
then
./bin/gettor_service start
fi
[provider]
name = Drive
[key]
fingerprint = EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290
[linux]
fa = https://docs.google.com/uc?id=0B76pDbk5No54eDRRUXdHcGIxMUU&export=download$https://docs.google.com/uc?id=0B76pDbk5No54amdUbGZNdnM5bjA&export=download$40ade5f6883a70af77de37da8a50bd72b533b1b65d198a0d8f02c2d5f4791355,
https://docs.google.com/uc?id=0B76pDbk5No54ZmFjRUs3VG9nZDA&export=download$https://docs.google.com/uc?id=0B76pDbk5No54TTBMYmwtdFVROEk&export=download$5666669aaeb695045a9263775d108a9fbe04899d3ef70aa27906a58245d713f4
en = https://docs.google.com/uc?id=0B76pDbk5No54bm1DdFZqRGZ6aFk&export=download$https://docs.google.com/uc?id=0B76pDbk5No54a2tKbXExaXpBdm8&export=download$0e94498cb83a07895bf8becf76d3c3b071d8cfadd50048971f701819f80a56aa,
https://docs.google.com/uc?id=0B76pDbk5No54SnBWZ3FYWDFZbnc&export=download$https://docs.google.com/uc?id=0B76pDbk5No54NldQSWpUODBNUW8&export=download$4b7fed9499915fd95497ccf13af00f6b5226d7066d24f6396d00666a5b8c1ad3
zh = https://docs.google.com/uc?id=0B76pDbk5No54VmV6TkcxVDl0eHc&export=download$https://docs.google.com/uc?id=0B76pDbk5No54Ymo5NFpuUmVjd1k&export=download$f1d5a0084d06e838a5acfe4352995c40c54ac4488006acb014ab7cf81360f62e,
https://docs.google.com/uc?id=0B76pDbk5No54R1lRbTM3bzJrQzQ&export=download$https://docs.google.com/uc?id=0B76pDbk5No54ZjJYTlRJS0ZoVjQ&export=download$d35a2f1dca74428f167bea96cc49c0c7351274904fafc30194592aa74201376a
tr = https://docs.google.com/uc?id=0B76pDbk5No54STZDTXYzUl9IbFU&export=download$https://docs.google.com/uc?id=0B76pDbk5No54ZHNIWV84RXZ5ZjQ&export=download$44bdcd53aaefc894f8556258b42fadc5fd10458db01f568734a47a9f6d070e5c,
https://docs.google.com/uc?id=0B76pDbk5No54MXFjaU9NbkVqS0k&export=download$https://docs.google.com/uc?id=0B76pDbk5No54VGhOaU1jLWlTWVk&export=download$79270b1cdcf41a251eb980281c29c2465ac06f299e0bacb9fd0190f87338d167
[windows]
zh = https://docs.google.com/uc?id=0B76pDbk5No54SndJVTJkZkprLUk&export=download$https://docs.google.com/uc?id=0B76pDbk5No54dHduYlFHRkJrczg&export=download$54443a66e16c8ffe02d10fe00e3bec50800eb4a93e2360a7d1b8a10f3bb77c0e
fa = https://docs.google.com/uc?id=0B76pDbk5No54OFlHX1Rybmc4b3c&export=download$https://docs.google.com/uc?id=0B76pDbk5No54Y19UdnMyVE5jMUk&export=download$15f06a3ad256042dde071690f4d4e53a5952fe9260592d5546cabda779eb8a47
en = https://docs.google.com/uc?id=0B76pDbk5No54OEQ1aG5DNXY2N00&export=download$https://docs.google.com/uc?id=0B76pDbk5No54YWp2alZKQ1hkNWs&export=download$443b38f4aa1194125ca3c79157272d5c64006928c9128127788c1cdefa642d85
tr = https://docs.google.com/uc?id=0B76pDbk5No54cUtBeUt4RmEtWVk&export=download$https://docs.google.com/uc?id=0B76pDbk5No54V1ZOcUotdjh2T2s&export=download$eff7885186fe3e5fc3bcc404d671175d279707d8e1e05d203a12a176aa4ea189
[osx]
en = https://docs.google.com/uc?id=0B76pDbk5No54Z0oxUnFuaHBpX00&export=download$https://docs.google.com/uc?id=0B76pDbk5No54ZXZqSFp5dngwN0E&export=download$f6a38fa3a72c9c60a457be6412f79e1efacd7ff5d993c48791550cc285ff164a
zh = https://docs.google.com/uc?id=0B76pDbk5No54cnhFUXFBaXJWUnM&export=download$https://docs.google.com/uc?id=0B76pDbk5No54U0h5UUp3QVI4eFE&export=download$eda5b7377b1a24fc918d9b16d4400a8b64975e57649623aea1e5e8b6b4f27dc6
fa = https://docs.google.com/uc?id=0B76pDbk5No54X2lraEZLM3p2Mk0&export=download$https://docs.google.com/uc?id=0B76pDbk5No54WV9vbUZlQ0FtcWM&export=download$5af13ce9f4d71195a204491ac30dea0a1cf75de41533fb2c3281fd7cbc3fb55d
tr = https://docs.google.com/uc?id=0B76pDbk5No54N2JYLU5MUXhXREU&export=download$https://docs.google.com/uc?id=0B76pDbk5No54eVFDLUJOLWlXemM&export=download$9363e252cee1a783a85dbdb000fc403da57cf2e32d63cf60d4e6f8a508e4bec4
[provider]
name = Dropbox
[key]
fingerprint = EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290
[linux]
en = https://www.dropbox.com/s/n99f4vh2pfvvsyv/tor-browser-linux64-5.0.3_en-US.tar.xz?dl=1$https://www.dropbox.com/s/jw8qtn6yujocx8m/tor-browser-linux64-5.0.3_en-US.tar.xz.asc?dl=1$4b7fed9499915fd95497ccf13af00f6b5226d7066d24f6396d00666a5b8c1ad3$,
https://www.dropbox.com/s/ljj2szpgozshye5/tor-browser-linux32-5.0.3_en-US.tar.xz?dl=1$https://www.dropbox.com/s/g0bvsimq5otmku1/tor-browser-linux32-5.0.3_en-US.tar.xz.asc?dl=1$0e94498cb83a07895bf8becf76d3c3b071d8cfadd50048971f701819f80a56aa$
fa = https://www.dropbox.com/s/6pn7arw9zunuzqh/tor-browser-linux32-5.0.3_fa.tar.xz?dl=1$https://www.dropbox.com/s/wdp8gy4dv2l4pta/tor-browser-linux32-5.0.3_fa.tar.xz.asc?dl=1$5666669aaeb695045a9263775d108a9fbe04899d3ef70aa27906a58245d713f4$,
https://www.dropbox.com/s/ry0o0faa0kwgy1o/tor-browser-linux64-5.0.3_fa.tar.xz?dl=1$https://www.dropbox.com/s/3mawfqt8wmvdjaz/tor-browser-linux64-5.0.3_fa.tar.xz.asc?dl=1$40ade5f6883a70af77de37da8a50bd72b533b1b65d198a0d8f02c2d5f4791355$
tr = https://www.dropbox.com/s/idya31ldqpjqb0z/tor-browser-linux32-5.0.3_tr.tar.xz?dl=1$https://www.dropbox.com/s/nao0ly0ymg3sxam/tor-browser-linux32-5.0.3_tr.tar.xz.asc?dl=1$44bdcd53aaefc894f8556258b42fadc5fd10458db01f568734a47a9f6d070e5c$,
https://www.dropbox.com/s/iaupd5h9em0gj1o/tor-browser-linux64-5.0.3_tr.tar.xz?dl=1$https://www.dropbox.com/s/cwgb5ccm8pn8ygh/tor-browser-linux64-5.0.3_tr.tar.xz.asc?dl=1$79270b1cdcf41a251eb980281c29c2465ac06f299e0bacb9fd0190f87338d167$
zh = https://www.dropbox.com/s/xpqzfu8atgzlr5k/tor-browser-linux64-5.0.3_zh-CN.tar.xz?dl=1$https://www.dropbox.com/s/xmdru6c3ajpgfun/tor-browser-linux64-5.0.3_zh-CN.tar.xz.asc?dl=1$d35a2f1dca74428f167bea96cc49c0c7351274904fafc30194592aa74201376a$,
https://www.dropbox.com/s/342siwbhr4iayv9/tor-browser-linux32-5.0.3_zh-CN.tar.xz?dl=1$https://www.dropbox.com/s/14om59ti9h7n0s6/tor-browser-linux32-5.0.3_zh-CN.tar.xz.asc?dl=1$f1d5a0084d06e838a5acfe4352995c40c54ac4488006acb014ab7cf81360f62e$
[windows]
en = https://www.dropbox.com/s/v4sm1m3sh4mr610/torbrowser-install-5.0.3_en-US.exe?dl=1$https://www.dropbox.com/s/lvu54ihfcsd3yez/torbrowser-install-5.0.3_en-US.exe.asc?dl=1$443b38f4aa1194125ca3c79157272d5c64006928c9128127788c1cdefa642d85$
fa = https://www.dropbox.com/s/09bdha17zy9c6kw/torbrowser-install-5.0.3_fa.exe?dl=1$https://www.dropbox.com/s/exaaccp2yx2rke7/torbrowser-install-5.0.3_fa.exe.asc?dl=1$15f06a3ad256042dde071690f4d4e53a5952fe9260592d5546cabda779eb8a47$
tr = https://www.dropbox.com/s/tx0vfk426qep9cs/torbrowser-install-5.0.3_tr.exe?dl=1$https://www.dropbox.com/s/nwbdj8zruymua8j/torbrowser-install-5.0.3_tr.exe.asc?dl=1$eff7885186fe3e5fc3bcc404d671175d279707d8e1e05d203a12a176aa4ea189$
zh = https://www.dropbox.com/s/y3rw3b8twdpbgff/torbrowser-install-5.0.3_zh-CN.exe?dl=1$https://www.dropbox.com/s/lbh81p8ve75cdrn/torbrowser-install-5.0.3_zh-CN.exe.asc?dl=1$54443a66e16c8ffe02d10fe00e3bec50800eb4a93e2360a7d1b8a10f3bb77c0e$
[osx]
tr = https://www.dropbox.com/s/g2i2v1y14qmzmtx/TorBrowser-5.0.3-osx64_tr.dmg?dl=1$https://www.dropbox.com/s/hyxlm0lb6rjhefg/TorBrowser-5.0.3-osx64_tr.dmg.asc?dl=1$9363e252cee1a783a85dbdb000fc403da57cf2e32d63cf60d4e6f8a508e4bec4$
en = https://www.dropbox.com/s/l0vg38jznpf2cty/TorBrowser-5.0.3-osx64_en-US.dmg?dl=1$https://www.dropbox.com/s/zxxgk6qffsx4ede/TorBrowser-5.0.3-osx64_en-US.dmg.asc?dl=1$f6a38fa3a72c9c60a457be6412f79e1efacd7ff5d993c48791550cc285ff164a$
fa = https://www.dropbox.com/s/omi2u8s8z8nf9p9/TorBrowser-5.0.3-osx64_fa.dmg?dl=1$https://www.dropbox.com/s/0g5zhnmpkv5qtsa/TorBrowser-5.0.3-osx64_fa.dmg.asc?dl=1$5af13ce9f4d71195a204491ac30dea0a1cf75de41533fb2c3281fd7cbc3fb55d$
zh = https://www.dropbox.com/s/hh9353slx9qfgi2/TorBrowser-5.0.3-osx64_zh-CN.dmg?dl=1$https://www.dropbox.com/s/q2wmc2nrkdyhjvh/TorBrowser-5.0.3-osx64_zh-CN.dmg.asc?dl=1$eda5b7377b1a24fc918d9b16d4400a8b64975e57649623aea1e5e8b6b4f27dc6$
[provider]
name = Dropbox
[key]
fingerprint = 8738 A680 B84B 3031 A630 F2DB 416F 0610 63FE E659
[linux]
en = Package (64-bit): https://www.dropbox.com/s/p2l6keaoly2kzce/tor-browser-linux64-3.6.2_en-EN.tar.xz?dl=0
ASC signature (64-bit): https://www.dropbox.com/s/b85ecxkoz9126j3/tor-browser-linux64-3.6.2_en-EN.tar.xz.asc?dl=0
Package SHA256 checksum (64-bit): 98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4,
Package (32-bit): https://www.dropbox.com/s/rxfczlz7j8gn6pi/tor-browser-linux32-3.6.2_en-EN.tar.xz?dl=0
ASC signature (32-bit): https://www.dropbox.com/s/g5g0havjgunf1un/tor-browser-linux32-3.6.2_en-EN.tar.xz.asc?dl=0
Package SHA256 checksum (32-bit): 98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4
es = Package (32-bit): https://www.dropbox.com/s/xkv4dvmeuppscs2/tor-browser-linux32-3.6.2_es-ES.tar.xz?dl=0
ASC signature (32-bit): https://www.dropbox.com/s/66c5x6jnzrs67vw/tor-browser-linux32-3.6.2_es-ES.tar.xz.asc?dl=0
Package SHA256 checksum (32-bit): 98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4
[windows]
en = Package (32-bit): https://www.dropbox.com/s/oocrw3joj4d8kn8/tor-browser-windows32-3.6.2_en-EN.tar.xz?dl=0
ASC signature (32-bit): https://www.dropbox.com/s/gwbepymnaxvhm94/tor-browser-windows32-3.6.2_en-EN.tar.xz.asc?dl=0
Package SHA256 checksum (32-bit): 98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4
[osx]
[provider]
name = GitHub
[key]
fingerprint = 8738 A680 B84B 3031 A630 F2DB 416F 0610 63FE E659
[linux]
en = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_en-US.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_en-US.tar.xz.asc$0e94498cb83a07895bf8becf76d3c3b071d8cfadd50048971f701819f80a56aa$,
https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_en-US.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_en-US.tar.xz.asc$4b7fed9499915fd95497ccf13af00f6b5226d7066d24f6396d00666a5b8c1ad3$
fa = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_fa.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_fa.tar.xz.asc$5666669aaeb695045a9263775d108a9fbe04899d3ef70aa27906a58245d713f4$,
https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_fa.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_fa.tar.xz.asc$40ade5f6883a70af77de37da8a50bd72b533b1b65d198a0d8f02c2d5f4791355$
tr = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_tr.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_tr.tar.xz.asc$44bdcd53aaefc894f8556258b42fadc5fd10458db01f568734a47a9f6d070e5c$,
https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_tr.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_tr.tar.xz.asc$79270b1cdcf41a251eb980281c29c2465ac06f299e0bacb9fd0190f87338d167$
zh = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_zh-CN.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux32-5.0.3_zh-CN.tar.xz.asc$f1d5a0084d06e838a5acfe4352995c40c54ac4488006acb014ab7cf81360f62e$,
https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_zh-CN.tar.xz$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/tor-browser-linux64-5.0.3_zh-CN.tar.xz.asc$d35a2f1dca74428f167bea96cc49c0c7351274904fafc30194592aa74201376a$
[windows]
en = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_en-US.exe$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_en-US.exe.asc$443b38f4aa1194125ca3c79157272d5c64006928c9128127788c1cdefa642d85$
fa = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_fa.exe$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_fa.exe.asc$15f06a3ad256042dde071690f4d4e53a5952fe9260592d5546cabda779eb8a47$
tr = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_tr.exe$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_tr.exe.asc$eff7885186fe3e5fc3bcc404d671175d279707d8e1e05d203a12a176aa4ea189$
zh = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_zh-CN.exe$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/torbrowser-install-5.0.3_zh-CN.exe.asc$54443a66e16c8ffe02d10fe00e3bec50800eb4a93e2360a7d1b8a10f3bb77c0e$
[osx]
en = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_en-US.dmg$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_en-US.dmg.asc$f6a38fa3a72c9c60a457be6412f79e1efacd7ff5d993c48791550cc285ff164a$
fa = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_fa.dmg$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_fa.dmg.asc$5af13ce9f4d71195a204491ac30dea0a1cf75de41533fb2c3281fd7cbc3fb55d$
tr = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_tr.dmg$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_tr.dmg.asc$9363e252cee1a783a85dbdb000fc403da57cf2e32d63cf60d4e6f8a508e4bec4$
zh = https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_zh-CN.dmg$https://raw.githubusercontent.com/TheTorProject/gettorbrowser/master/5.0.3/TorBrowser-5.0.3-osx64_zh-CN.dmg.asc$eda5b7377b1a24fc918d9b16d4400a8b64975e57649623aea1e5e8b6b4f27dc6$
...@@ -182,17 +182,21 @@ class Sendmail(object): ...@@ -182,17 +182,21 @@ class Sendmail(object):
version = link[4] version = link[4]
arch = link[3] arch = link[3]
url = link[0] url = link[0]
file = link[6]
sig_url = url + ".asc"
link_str = "Tor Browser {} for {}-{}-{} ({}): {}".format( link_str = "Tor Browser {} for {}-{}-{} ({}): {}\n".format(
version, platform, locale, arch, provider, url version, platform, locale, arch, provider, url
) )
link_str += "Signature file: {}\n".format(sig_url)
if link_msg: if link_msg:
link_msg = "{}\n{}".format(link_msg, link_str) link_msg = "{}\n{}".format(link_msg, link_str)
else: else:
link_msg = link_str link_msg = link_str
body_msg = strings._("links_body").format(platform, link_msg) body_msg = strings._("links_body").format(platform, link_msg, file)
subject_msg = strings._("links_subject") subject_msg = strings._("links_subject")
hid = hashlib.sha256(id.encode('utf-8')) hid = hashlib.sha256(id.encode('utf-8'))
......
...@@ -142,7 +142,7 @@ def main(): ...@@ -142,7 +142,7 @@ def main():
release_link = releases.get(k).replace("en-US", l) release_link = releases.get(k).replace("en-US", l)
c.execute( c.execute(
"INSERT INTO links(link, platform, language, arch, version, provider, status)" "INSERT INTO links(link, platform, language, arch, version, provider, status)"
"VALUES ('%s', '%s', '%s', '64', '%s', '%s', 'ACTIVE')" % (providers.get(p) + release_link, k, l, version, p)) "VALUES ('%s', '%s', '%s', '64', '%s', '%s', 'ACTIVE', '%s')" % (providers.get(p) + release_link, k, l, version, p, release_link))
if __name__ == "__main__": if __name__ == "__main__":
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: hiro <hiro@torproject.org>
# see also AUTHORS file
#
# :license: This is Free Software. See LICENSE for license information.
import sys
import smtplib
import time
import imaplib
import email
import time
# Standard Nagios return codes
OK, WARNING, CRITICAL, UNKNOWN = range(4)
ORG_EMAIL = "@gmail.com"
FROM_EMAIL = "test.gettor.browser" + ORG_EMAIL
SMTP_SERVER = "imap.gmail.com"
SMTP_PORT = 993
MESSAGE_FROM = "gettor@torproject.org"
MESSAGE_SUBJECT = "[GetTor] Links for your request"
MESSAGE_BODY = "https://gitlab.com/thetorproject/"
STATUS_FILE = "/srv/gettor.torproject.org/check/status"
# -------------------------------------------------
#
# Utility to read email from Gmail Using Python
#
# ------------------------------------------------
def test_email_from_gmail(password):
try:
mail = imaplib.IMAP4_SSL(SMTP_SERVER)
mail.login(FROM_EMAIL, password)
mail.select('INBOX')
type, data = mail.search(None, 'ALL')
mail_ids = data[0]
id_list = mail_ids.split()
first_email_id = int(str(id_list[0], 'utf-8'))
latest_email_id = int(str(id_list[-1], 'utf-8'))
for i in range(int(latest_email_id), int(first_email_id), -1):
typ, data = mail.fetch(str(i), '(RFC822)')
for response_part in data:
if isinstance(response_part, tuple):
m = str(response_part[1], 'utf-8')
msg = email.message_from_string(m)
email_subject = "{}".format(msg['subject'])
email_from = "{}".format(msg['from'])
email_body = "{}".format(msg.as_string())
if (MESSAGE_FROM == email_from) and (MESSAGE_SUBJECT == email_subject) and (MESSAGE_BODY in email_body):
mail.store(str(i), '+FLAGS', '\\Deleted')
return OK, "Found correct gettor email."
else:
print('if not working')
mail.store(str(i), '+FLAGS', '\\Deleted')
return WARNING, "No emails from gettor found"
except Exception as e:
return CRITICAL, str(e)
def send_email_from_gmail(password):
sent_from = FROM_EMAIL
sent_to = [MESSAGE_FROM]
subject = 'windows en'
body = 'windows en'
email_text = """From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (sent_from, ", ".join(sent_to), subject, body)
try:
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(sent_from, password)
server.sendmail(sent_from, to, email_text)
server.close()
except Exception as e:
return UNKNOWN, str(e)
if __name__ == "__main__":
status, message = None, None
host = None
use_https = False
if len(sys.argv) == 2:
password = sys.argv[1]
else:
password = "yourPassword"
status_file = open(STATUS_FILE,'w')
try:
status, message = send_email_from_gmail(password)
except Exception as e:
status = CRITICAL
message = repr(e)
sys.exit(status)
time.sleep(180)
try:
status, message = test_email_from_gmail(password)
except KeyboardInterrupt:
status, message = CRITICAL, "Caught Control-C..."
except Exception as e:
status = CRITICAL
message = repr(e)
finally:
if status == OK:
status_file.write("OK: %s" % message)
elif status == WARNING:
status_file.write("WARNING: %s" % message)
elif status == CRITICAL:
status_file.write("CRITICAL: %s" % message)
else:
status_file.write("UNKNOWN: %s" % message)
status = UNKNOWN
sys.exit(status)
...@@ -87,7 +87,7 @@ def main(): ...@@ -87,7 +87,7 @@ def main():
) )
c.execute( c.execute(
"CREATE TABLE links(link TEXT, platform TEXT, language TEXT," "CREATE TABLE links(link TEXT, platform TEXT, language TEXT,"
" arch TEXT, version TEXT, provider TEXT, status TEXT)" " arch TEXT, version TEXT, provider TEXT, status TEXT, file TEXT)"
) )
c.execute( c.execute(
"CREATE TABLE stats(num_requests NUMBER, platform TEXT," "CREATE TABLE stats(num_requests NUMBER, platform TEXT,"
...@@ -122,7 +122,7 @@ def main(): ...@@ -122,7 +122,7 @@ def main():
) )
c.execute( c.execute(
"CREATE TABLE links(link TEXT, platform TEXT, language TEXT," "CREATE TABLE links(link TEXT, platform TEXT, language TEXT,"
"arch TEXT, version TEXT, provider TEXT, status TEXT," "arch TEXT, version TEXT, provider TEXT, status TEXT, file TEXT"
"PRIMARY KEY(platform, arch, version, provider, status))" "PRIMARY KEY(platform, arch, version, provider, status))"
) )
c.execute( c.execute(
......
...@@ -10,8 +10,13 @@ ...@@ -10,8 +10,13 @@
# :license: This is Free Software. See LICENSE for license information. # :license: This is Free Software. See LICENSE for license information.
cd ~/releases cd ~/releases
git checkout releases git checkout master
rm -f torbrowser-* TorBrowser-* tor-browser-* git branch -D releases
git push origin --delete releases
git branch -D torbrowser-releases
git push github --delete torbrowser-releases
git fetch --all --prune
for row in $( for row in $(
curl -s 'https://aus1.torproject.org/torbrowser/update_3/release/downloads.json' | curl -s 'https://aus1.torproject.org/torbrowser/update_3/release/downloads.json' |
...@@ -25,7 +30,7 @@ for row in $( ...@@ -25,7 +30,7 @@ for row in $(
if [[ $r = *[!\ ]* ]]; then if [[ $r = *[!\ ]* ]]; then
wget $r wget $r
git fetch --all git fetch --all
git checkout releases git checkout -b releases
git add . git add .
git commit -m '[dist ci] commit from CI runner - update with new torbrowser downloads' git commit -m '[dist ci] commit from CI runner - update with new torbrowser downloads'
diffs=$(git diff origin/releases) diffs=$(git diff origin/releases)
...@@ -34,8 +39,7 @@ for row in $( ...@@ -34,8 +39,7 @@ for row in $(
else else
git push -f --follow-tags origin releases git push -f --follow-tags origin releases
fi fi
git checkout torbrowser-releases git checkout -b torbrowser-releases
git merge releases
diffs=$(git diff github/torbrowser-releases) diffs=$(git diff github/torbrowser-releases)
if [ -z "$diffs" ]; then if [ -z "$diffs" ]; then
echo "No new releases" echo "No new releases"
...@@ -44,3 +48,12 @@ for row in $( ...@@ -44,3 +48,12 @@ for row in $(
fi fi
fi; fi;
done done
rclone delete gdrive:releases
for f in $(ls); do
# Update Google Drive
rclone copy $f gdrive:releases
# Update Internet Archive
ia upload <identifier> - --remote-name=$f --metadata="title:New Tor Browser release ${f}."
done
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"smtp_help_subject": "[GetTor] Help", "smtp_help_subject": "[GetTor] Help",
"smtp_unsupported_locale_subject": "[GetTor] Unsupported locale", "smtp_unsupported_locale_subject": "[GetTor] Unsupported locale",
"smtp_unsupported_locale_msg": "The locale you requested '{}' is not supported.", "smtp_unsupported_locale_msg": "The locale you requested '{}' is not supported.",
"smtp_vlinks_msg": "You requested Tor Browser for {}.\n\nYou will need only one of the links below to download the bundle. If a link does not work for you, try the next one.\n\n{}\n\n \n--\nGetTor", "smtp_vlinks_msg": "You requested Tor Browser for {}.\n\nYou will need only one of the links below to download the bundle. If a link does not work for you, try the next one.\n\n{}\n\nShould you have issues with any of the links above you can access the following Google Drive folder: https://drive.google.com/open?id=13CADQTsCwrGsIID09YQbNz2DfRMUoxUU\n\n Download the file: {}\n\n \n--\nGetTor",
"smtp_mirrors_msg": "Hi! this is the GetTor robot.\n\nThank you for your request. Attached to this email you will find\nan updated list of mirrors of Tor Project's website.", "smtp_mirrors_msg": "Hi! this is the GetTor robot.\n\nThank you for your request. Attached to this email you will find\nan updated list of mirrors of Tor Project's website.",
"smtp_help_msg": "Hi! This is the GetTor robot. I am here to help you download the\nlatest version of Tor Browser.\n\nPlease reply to this message with one of the options below:\n\nwindows\nlinux\nosx\nmirrors\n\nI will then send you the download instructions.\n\nIf you are unsure, just send a blank reply to this message." "smtp_help_msg": "Hi! This is the GetTor robot. I am here to help you download the\nlatest version of Tor Browser.\n\nPlease reply to this message with one of the options below:\n\nwindows\nlinux\nosx\nmirrors\n\nI will then send you the download instructions.\n\nIf you are unsure, just send a blank reply to this message."
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment