Tired of Trojan Check every day? You need this. TrojanPass will automate the process of wellness assessment and send the pass to your mailbox.
You can use cron to schedule TrojanCheck, making your life easier.
- A USC account (SSO)
- A Gmail account with App Passwords, this is required for security concerns
You need to verify your account (by adding a credit card)if you want to schedule a daily job. This project never use any Dyno quota. It should be okay if you only use heroku to run this project.
First, in the project root, run ./heroku_deploy.sh
, then set environment variable by
heroku config:set TROJAN_PASS_NETID=<Your Net ID>
heroku config:set TROJAN_PASS_PASSWORD=<Your NetID password>
heroku config:set TROJAN_PASS_GMAIL_ACCOUNT=<Your Gmail Account>
heroku config:set TROJAN_PASS_GMAIL_PASSWORD=<Your Gmail Password>
Note: It should be secure if you only set your credential as Heroku config under the assumption of a strong password for Heroku account.
Last, deploy and trigger the build:
# Only for deploy
git add . && git commit --allow-empty -m "trigger deploy" && git push heroku main
To get the pass, run heroku run get_pass
inside your heroku project.
Select your 'trojan-pass-' project in Heroku dashboard, then click Heroku Scheduler
in Installed add-ons
.
Create a job at 3:00 PM everyday
(UTC time) running python main.py
. This will let Heroku server send you a pass every day at 8:00 AM
PTDt time.
This could violate GitHub Action's term of use, but should be fine if you just want to test for a few weeks.
Fork this project, then add the following project secrets:
TROJAN_PASS_NETID
TROJAN_PASS_PASSWORD
TROJAN_PASS_GMAIL_ACCOUNT
TROJAN_PASS_GMAIL_PASSWORD
You need to
- enable repo
Action
(appear as in tabs above the repo name) - enable
Get Trojan Pass
Action - run it instantly or wait for the automation
On Ubuntu with bash:
git clone https://github.com/dqwert/TrojanPass.git
cd TrojanPass
# root privilege required
./scripts/setup_firefox.sh
# IMPORTANT: replace <>s with your info
`printf '\n# Trojan Pass\nexport TROJAN_PASS_NETID="<Your Net ID>"\nexport TROJAN_PASS_PASSWORD="<Your NetID password>"\nexport TROJAN_PASS_GMAIL_ACCOUNT="<Your Gmail Account>"\nexport TROJAN_PASS_GMAIL_PASSWORD="<Your Gmail Password>"\n' >> ~/.bash_profile
python3 main.py
Optional: setup crontab, see below.
- set your system environment variables:
- Unix
- ZSH:
printf '\n# Trojan Pass\nexport TROJAN_PASS_NETID="<Your Net ID>"\nexport TROJAN_PASS_PASSWORD="<Your NetID password>"\nexport TROJAN_PASS_GMAIL_ACCOUNT="<Your Gmail Account>"\nexport TROJAN_PASS_GMAIL_PASSWORD="<Your Gmail Password>"\n' >> ~/.zshrc
- Bash:
printf '\n# Trojan Pass\nexport TROJAN_PASS_NETID="<Your Net ID>"\nexport TROJAN_PASS_PASSWORD="<Your NetID password>"\nexport TROJAN_PASS_GMAIL_ACCOUNT="<Your Gmail Account>"\nexport TROJAN_PASS_GMAIL_PASSWORD="<Your Gmail Password>"\n' >> ~/.bash_profile
(or>> ~/.bashrc
). - Note: use
echo
in macOS andprintf
on Linux - For example, on macOS 11.6, suppose the NET ID is
wq
, password isfoo
, Gmail account iswangqin0.me@gmail.com
, Gmail password isfool
open the Terminal and executeecho '\n# Trojan Pass\nexport TROJAN_PASS_NETID="wq"\nexport TROJAN_PASS_PASSWORD="foo"\nexport TROJAN_PASS_GMAIL_ACCOUNT="wangqin0.me@gmail.com"\nexport TROJAN_PASS_GMAIL_PASSWORD="fool"\n' >> ~/.zshrc
- ZSH:
- Windows
- The py-dotenv helps Windows user to set up Environment Variables easily, all you need is a
.env
file inside the project folder. You can take a look at the format in.env.examples
. - Also, you can set up environment variables manually, take look at about_Environment_Variables in Microsoft Docs.
- The py-dotenv helps Windows user to set up Environment Variables easily, all you need is a
- Notice that
<>
is NOT in the actual command; for security concerns, please don't hard code your password into the program.
- Unix
Firefox: ./setup_scripts/setup_firefox.sh
Chrome: ./setup_scripts/setup_chrome.sh
Download the browser and related chrome driver. Add the driver to path directory.
- Run once:
xvfb-run python3 <project root>/main.py
(for example:xvfb-run python3 ~/TrojanPass/main.py
), note that you need to manually set environment variables incrontab -e
. - Run every day: Execute
cron -e
in shell then add following line:20 15 * * * cd <path to TrojanPass> && xvfb-run python3 main.py &> ~/TrojanPass.log
, this will run task at 7:00 am every day and log is saved to~/TrojanCheck.log
.
Inside project, run once: python3 main.py
.
https://elements.heroku.com/buildpacks/gordiansoftware/heroku-integrated-firefox-geckodriver