Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TorBot GUI #152

Merged
merged 37 commits into from Dec 7, 2018
Merged

TorBot GUI #152

merged 37 commits into from Dec 7, 2018

Conversation

KingAkeem
Copy link
Member

This is the beginning of a long road, I'm just laying out the initial front end architecture of TorBot. I'm using React, Electron, Yarn and Webpack. If you have any questions feel fee to ask in the PR, I'm going to fill out more information for those that are interested.

ui/webpack.config.js Outdated Show resolved Hide resolved
ui/webpack.config.js Outdated Show resolved Hide resolved
ui/webpack.config.js Outdated Show resolved Hide resolved
ui/webpack.config.js Outdated Show resolved Hide resolved
ui/webpack.config.js Outdated Show resolved Hide resolved
ui/src/renderer.js Outdated Show resolved Hide resolved
ui/src/electron-main.js Outdated Show resolved Hide resolved
ui/src/electron-main.js Outdated Show resolved Hide resolved
ui/src/electron-main.js Outdated Show resolved Hide resolved
ui/src/electron-main.js Outdated Show resolved Hide resolved
ui/src/components/home.js Outdated Show resolved Hide resolved
render() {
return (
<React.Fragment>
<h1 align='center'>TorBot</h1>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclosed regular expression.
Unrecoverable syntax error. (76% scanned).


onSubmit(event) {
let scope = this;
let ws = new WebSocket('ws://localhost:8080')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Missing semicolon.

@DedSecInside DedSecInside deleted a comment from hound bot Nov 17, 2018
@DedSecInside DedSecInside deleted a comment from hound bot Nov 17, 2018
@DedSecInside DedSecInside deleted a comment from hound bot Nov 17, 2018
ui/src/app.js Outdated
}
}

export default App;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'export' is only available in ES6 (use 'esversion: 6').

ui/src/app.js Outdated

class App extends React.Component {
render() {
return <Home/>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Expected an identifier and instead saw '<'.
Expected an identifier and instead saw '>'.
Missing semicolon.

ui/src/app.js Outdated
import Home from './components/home';
import './app.css';

class App extends React.Component {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'class' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

ui/src/app.js Outdated
@@ -0,0 +1,11 @@
import React from 'react';
import Home from './components/home';
import './app.css';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

ui/src/app.js Outdated
@@ -0,0 +1,11 @@
import React from 'react';
import Home from './components/home';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')
async def handle_msg(websocket, path):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 0

self.response = proxyGET(link)
else:
self.response = requests.get(link)
except (requests.exceptions.ChunkedEncodingError, requests.exceptions.HTTPError, requests.exceptions.ConnectionError, ConnectionError) as err:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (150 > 79 characters)

return session.get(url, headers=headers)
else:
return session.get(url)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file

modules/proxy.py Outdated
}
session = requests.session()
session.proxies = proxies
def proxyGET(url, headers=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 0

});
const HtmlWebpackPlugin = require('html-webpack-plugin');

const path = require('path');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

@@ -0,0 +1,8 @@
import React from 'react';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'import' is only available in ES6 (use 'esversion: 6').

mainWindow = new BrowserWindow(browserOptions);

// Configuring locaiton for HTML outputted after React
const startURL = url.format({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const url = require('url');

function createWindow () {
let browserOptions = {width: 800, height: 600};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

status = requests.head(link, timeout=5).ok
yield {'name': link, 'status': status}
except Exception as err:
yield {'name': link, 'status': False, 'error': str(err)}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace


soup = BeautifulSoup(response.text, 'html.parser')
anchor_tags = soup.find_all('a')
links = list()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local variable 'links' is assigned to but never used

response = json.dumps(link)
await websocket.send(response)

async def get_links(websocket, url):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')

async def handle_msg(websocket, path):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

render() {
let links = this.state.links;
if (!links.length) {
return <h1>Links Incoming</h1>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.
Expected an identifier and instead saw '<'.
Missing semicolon.
Unclosed regular expression.
Unrecoverable syntax error. (75% scanned).

* @memberof Links
*/
render() {
let links = this.state.links;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

*/
onHome(event) {
this.websocket.close(1000); // Send normal closure code
ReactDOM.render(<Home/>, document.getElementById('root'));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected ')' and instead saw 'Home'.
Expected an assignment or function call and instead saw an expression.
Expected an identifier and instead saw ')'.
Expected an identifier and instead saw '<'.
Expected an identifier and instead saw '>'.
Missing semicolon.

return;
}
let stateLinks = this.state.links;
stateLinks.push(link)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

return session.head(url, timeout=timeout, headers=headers)
else:
return session.head(url, timeout=timeout)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file

modules/proxy.py Outdated
else:
return session.get(url)

def proxyHEAD(url, timeout=10, headers=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

modules/proxy.py Outdated
session = requests.session()
session.proxies = proxies

def proxyGET(url, headers=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

modules/proxy.py Outdated
Peforms HEAD request using socks5 proxy

Args:
url (string): url to retreive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

modules/proxy.py Outdated
def proxyHEAD(url, timeout=10, headers=None):
"""
Peforms HEAD request using socks5 proxy

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

modules/proxy.py Outdated
Peforms GET request using socks5 proxy

Args:
url (string): url to retreive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

modules/proxy.py Outdated
def proxyGET(url, headers=None):
"""
Peforms GET request using socks5 proxy

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

modules/proxy.py Outdated
host (string): host name or IP Address
port (string): port number
"""
global proxies # Allows us to modify global variable directly
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least two spaces before inline comment

modules/proxy.py Outdated

def setProxy(host, port):
"""
Sets host and port for tor proxies being used when performing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

modules/proxy.py Outdated
session = requests.session()
session.proxies = proxies

def setProxy(host, port):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

}
session.proxies = proxies

def proxy_get(url, headers=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

modules/proxy.py Outdated
host (string): host name or IP Address
port (string): port number
"""
global proxies #Allows us to modify global variable directly
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline comment should start with '# '

# If there's an exception then we assume the link is bad
yield {'name': link, 'status': False, 'error': str(err)}

def start_wsserver():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

return

soup = BeautifulSoup(response.text, 'html.parser')
anchor_tags = soup.find_all('a') # Anchor tags contain links
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least two spaces before inline comment

response = proxy_get(url)
else:
response = requests.get(url)
except Exception as err:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

path (string): contains origin of websocket message
"""
msg = await websocket.recv()
data = json.loads(msg) # Load JSON response from front-end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least two spaces before inline comment

response = requests.head(url)
return dict(response.headers)

async def get_links(url):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@PSNAppz PSNAppz mentioned this pull request Dec 5, 2018
@KingAkeem KingAkeem changed the base branch from dev to front_end December 7, 2018 13:42
@KingAkeem KingAkeem merged commit 4650a52 into DedSecInside:front_end Dec 7, 2018
@PSNAppz PSNAppz changed the title Adding GUI to TorBot :) TorBot GUI Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant