-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a5563ac
Showing
1,234 changed files
with
82,751 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# VPN Keybase Bot | ||
|
||
## Overview | ||
This bot runs an Algo VPN script | ||
|
||
## Local Installation Guide | ||
### 1. Install and run keybase on local device | ||
|
||
You should install and run the keybase application on your device. | ||
|
||
> **Note**: We recommend either creating a dedicated Keybase account for the bot, or if you decide to reuse your own account at the very least create a dedicated paperkey so you can revoke it later if the machines rise up. | ||
#### Example for Ubuntu installation | ||
|
||
``` | ||
curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb | ||
sudo apt install ./keybase_amd64.deb | ||
run_keybase | ||
``` | ||
|
||
### 2. Download the source & install dependencies | ||
|
||
Clone the repository with the following command: | ||
|
||
```sh | ||
git clone https://github.com/Tgemayel/vpnbot.git | ||
``` | ||
|
||
Next, navigate into the project folder of downloaded source and install the NPM dependencies: | ||
|
||
```sh | ||
cd vpnbot | ||
yarn install (or npm install) | ||
``` | ||
|
||
### 3. Configuration | ||
Before run bot server, we should set configuration and environment variables. | ||
|
||
In the project on terminal, copy .env.example file to .env file. | ||
|
||
``` | ||
cp .env.example .env | ||
``` | ||
|
||
Change the keybase account info in the .env file and save it. | ||
|
||
running: | ||
``` | ||
npm start (or yarn start) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const Bot = require('keybase-bot') | ||
const dotenv = require('dotenv') | ||
|
||
dotenv.config() | ||
|
||
async function main() { | ||
const server_bot = new Bot() | ||
const server_username = process.env.SERVER_KB_USERNAME | ||
const server_paperkey = process.env.SERVER_KB_PAPERKEY | ||
|
||
const bot = new Bot() | ||
const username = process.env.KB_USERNAME | ||
const paperkey = process.env.KB_PAPERKEY | ||
|
||
try { | ||
await bot.init(username, paperkey) | ||
await server_bot.init(server_username, server_paperkey) | ||
|
||
const info = bot.myInfo() | ||
console.log(`bot initialized with username ${info.username}.`) | ||
const channel = {name: 'vpnbot,' + info.username, public: false, topicType: 'chat'} | ||
|
||
const onMessage = async message => { | ||
if (message.content.type === 'text') { | ||
// TODO: could probably normalize the body a little more before comparisons | ||
const messageBody = message.content.text.body.toLowerCase() | ||
switch (messageBody) { | ||
case 'new': | ||
console.log('Starting a new vpn!') | ||
// Todo: run script to build a vpn | ||
await server_bot.chat.send(channel, {body: 'Starting a new vpn..'}) | ||
await server_bot.chat.attach(channel, '/server/path/here/wg0.conf') | ||
break | ||
default: | ||
break | ||
} | ||
} | ||
} | ||
|
||
await server_bot.chat.send(channel, {body: ':wave: Welcome to VPN Bot.'}) | ||
await server_bot.chat.send(channel, {body: 'To spin up a new VPN, type "new".'}) | ||
|
||
const onError = e => console.error(e) | ||
console.log(`Listening in the general channel of ${channel.name}...`) | ||
await bot.chat.watchChannelForNewMessages(channel, onMessage, onError) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
async function shutDown() { | ||
await bot.deinit() | ||
process.exit() | ||
} | ||
|
||
process.on('SIGINT', shutDown) | ||
process.on('SIGTERM', shutDown) | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "vpnkeybasebot", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "node index.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"dotenv": "^8.1.0", | ||
"keybase-bot": "^3.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
- | ||
files: "clipboard.min.js" | ||
from: "node_modules/clipboard/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "jquery.min.js" | ||
from: "node_modules/jquery/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "jquery.countdown.min.js" | ||
from: "node_modules/jquery-countdown/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "flatpickr.min.js" | ||
from: "node_modules/flatpickr/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "flatpickr.min.css" | ||
from: "node_modules/flatpickr/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "flickity.pkgd.min.js" | ||
from: "node_modules/flickity/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "flickity.css" | ||
from: "node_modules/flickity/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "ion.rangeSlider.min.js" | ||
from: "node_modules/ion-rangeslider/js" | ||
to: "pages/assets/js" | ||
- | ||
files: "ion.rangeSlider.css" | ||
from: "node_modules/ion-rangeslider/css" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "isotope.pkgd.min.js" | ||
from: "node_modules/isotope-layout/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "jquery.fancybox.min.css" | ||
from: "node_modules/@fancyapps/fancybox/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "jquery.fancybox.min.js" | ||
from: "node_modules/@fancyapps/fancybox/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "popper.min.js" | ||
from: "node_modules/popper.js/dist/umd" | ||
to: "pages/assets/js" | ||
- | ||
files: "popper.min.js.map" | ||
from: "node_modules/popper.js/dist/umd" | ||
to: "pages/assets/js" | ||
- | ||
files: "prism.js" | ||
from: "node_modules/prismjs" | ||
to: "pages/assets/js" | ||
- | ||
files: "prism.css" | ||
from: "node_modules/prismjs/themes" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "prism-okaidia.css" | ||
from: "node_modules/prismjs/themes" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: | ||
- "scrollMonitor.js" | ||
- "scrollMonitor.js.map" | ||
from: "node_modules/scrollmonitor" | ||
to: "pages/assets/js" | ||
- | ||
files: "smooth-scroll.polyfills.min.js" | ||
from: "node_modules/smooth-scroll/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: | ||
- "svg-injector.umd.production.js" | ||
- "svg-injector.umd.production.js.map" | ||
from: "node_modules/@tanem/svg-injector/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: | ||
- "typed.min.js" | ||
- "typed.min.js.map" | ||
from: "node_modules/typed.js/lib" | ||
to: "pages/assets/js" | ||
- | ||
files: "aos.css" | ||
from: "node_modules/aos/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "aos.js" | ||
from: "node_modules/aos/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "twitterFetcher_min.js" | ||
from: "node_modules/twitter-fetcher/js" | ||
to: "pages/assets/js" | ||
- | ||
files: | ||
- "jarallax.min.js" | ||
- "jarallax-video.min.js" | ||
- "jarallax-element.min.js" | ||
- "jarallax.min.js.map" | ||
- "jarallax-video.min.js.map" | ||
- "jarallax-element.min.js.map" | ||
from: "node_modules/jarallax/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: "jarallax.css" | ||
from: "node_modules/jarallax/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: "plyr.css" | ||
from: "node_modules/plyr/dist" | ||
to: "scss/custom/components/plugins" | ||
- | ||
files: | ||
- "plyr.polyfilled.min.js" | ||
- "plyr.polyfilled.min.js.map" | ||
from: "node_modules/plyr/dist" | ||
to: "pages/assets/js" | ||
- | ||
files: | ||
- "*.woff" | ||
- "*.woff2" | ||
from: "node_modules/inter-ui/Inter UI (web)" | ||
to: "assets/fonts" | ||
- | ||
files: "jquery.smartWizard.min.js" | ||
from: "node_modules/smartwizard/dist/js" | ||
to: "pages/assets/js" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
// SETTINGS FOR MAILCHIMP SUBSCRIPTION | ||
|
||
// Log in to MailChimp and create an API key under: | ||
// [ Account ] -> [ Extras ] -> [ API Keys ] | ||
$apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us8'; | ||
|
||
// Find your list ID by opening the list in MailChimp, then: | ||
// [ Settings ] -> [ List name and defaults ] | ||
$listId = 'abcdefghij'; | ||
|
||
// Form data to use as email field | ||
// (The name="..." value from the email field in your HTML form) | ||
$emailField = 'email'; | ||
|
||
// Fields to be submitted to your MailChimp list along with the email address | ||
// In this example, "NAME" is the field in your MailChimp list, | ||
// and $_POST["name"] is the form data from the user to fill that field | ||
$mergeFields = array( | ||
"NAME" => $_POST["name"], | ||
); | ||
|
||
// What the user's status will be after submitting. | ||
// Options are 'pending', 'subscribed', 'unsubscribed', 'cleaned' | ||
// We recommend 'pending' as this will result in the user receiving | ||
// an opt-in confirmation email from MailChimp. | ||
// For single opt-in use 'subscribed'. | ||
$status = 'pending'; | ||
|
||
// Text to show user upon successful subscribe operation | ||
$successMessage = "Thanks for subscribing, please check your inbox for confirmation."; | ||
|
||
// Text to show when the user is already subscribed to the list | ||
$alreadySubscribed = "You are already subscribed to this list."; | ||
|
||
// Text to show when the user is already subscribed to the list | ||
$checkConfirmation = "Your subscription is pending, check your inbox for a confirmation link."; | ||
|
||
// Google reCAPTCHA | ||
// If your form is configured with a reCAPTCHA widget, this secret key will be used to validate with Google's server. | ||
$recaptchaSecretKey = 'insert-your-recaptcha-secret-key-here'; | ||
$recaptchaErrorMessage = 'There was a problem verifying the Google reCaptcha. Please try again.'; | ||
|
||
require('vendor/mediumrare/mailchimp_subscribe.php'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
// error_reporting(-1); | ||
// ini_set('display_errors', 'On'); | ||
|
||
/*----------------------------------------------------------------------------*\ | ||
|* Email settings for sending all emails from your website forms. *| | ||
\*============================================================================*/ | ||
|
||
|
||
// Set the details of your SMTP server here: | ||
// These details will be used to log in to the SMTP server and send an email | ||
// to the site admin when a user submits a form. | ||
// Optionally, you can send an email to the user to confirm receipt of their form submission. | ||
|
||
// Outgoing Server Settings - replace values on the right of the = sign with your own. | ||
// These 3 settings are are required. | ||
// We do not recommend using Gmail as a server to send email. | ||
// We recommend that you set up an email address on your hosting provider to perform the sending. | ||
// (see cPanel -> email accounts). Using an account at your host improves deliverability. | ||
|
||
// These are the Outgoing Server (SMTP) details provided by your email host | ||
$outgoingServerAddress = 'server.company.com'; // consult your hosting provider. | ||
$outgoingServerPort = '25'; // '587' , '25' - consult your hosting provider | ||
$outgoingServerSecurity = 'tls'; // 'ssl' , 'tls' , null - consult your hosting provider. | ||
|
||
// Sending Account Settings - replace these details with an email account held on the SMTP server entered above. | ||
// This will also be used as the account to send the confirmation to the user. | ||
$sendingAccountUsername = 'insert_your_account_here'; | ||
$sendingAccountPassword = 'insert_your_password_here'; | ||
|
||
// Recipient (To:) Details - Change this to the email details of who will receive all the emails from the website. | ||
$recipientEmail = '[email protected]'; // Where to send the admin email. | ||
$recipientName = 'Recipient Name'; // Name of admin to receive email from website. | ||
|
||
// Email details - Change these to suit your website needs | ||
$emailSubject = 'A message from a form on your website'; // Subject of the email that the admin will see. | ||
$websiteName = 'Edit your company website name'; // This is used as the "From name". | ||
$adminEmailTemplate = 'email_to_admin.html'; // Name of template (in templates folder) to use for email to admin. | ||
|
||
// Success Message to display in browser | ||
$successMessage = 'Thank you, a member of our team will be in touch shortly.'; | ||
|
||
// Google reCAPTCHA | ||
// If your form is configured with a reCAPTCHA widget, this secret key will be used to validate with Google's server. | ||
$recaptchaSecretKey = 'optionally_insert_your_recaptcha_secret_key_here'; | ||
$recaptchaErrorMessage = 'There was a problem verifying the Google reCaptcha. Please try again.'; | ||
|
||
// Send User a Confirmation Email? | ||
$sendConfirmationToUser = true; // leave false to disable confirmation, set to true to enable. | ||
$userEmailField = "contact-email"; // What part of form data to use as an address to send confirmation email. | ||
$userNameField = "contact-name"; // What part of form data to use as the user's name on confirmation email. | ||
$confirmationEmailTemplate = "confirmation_to_user.html"; // Name of template (in templates folder) to use for email to user. | ||
$confirmationSubject = "Thanks for testing our contact form!"; // The subject of the confirmation email. | ||
$confirmationFromName = "A Template by Medium Rare"; // Used in the "from" field of the email. | ||
$confirmationReplyTo = "[email protected]"; // If the user wants to reply to the confirmation email, where should it go? | ||
// The text replacements to use when constructing the confirmation email body | ||
// Eg. By default, this will replace [[name]] in the email template with | ||
// the 'name' field sent through the form. ucfirst sets the first letter to uppercase. | ||
$confirmationReplacements = array( | ||
"[[contact-name]]" => ucfirst($_POST["contact-name"]), | ||
"[[mRareAddress]]" => 'http://mrare.co', | ||
); | ||
|
||
// Save to CSV file to keep a text record of the form entries | ||
// This file should be password protected! | ||
$saveToCSV = true; | ||
$saveToCSVFileName = "csv/csv_forms_email_1.csv"; | ||
|
||
/*----------------------------------------------------------------------------*\ | ||
|* You do not need to edit anything below this line, the rest is automatic. *| | ||
\*============================================================================*/ | ||
include('vendor/mediumrare/smtp_email.php'); | ||
|
||
?> |
Oops, something went wrong.