Skip to content

Commit

Permalink
initial beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
mh4x0f committed Sep 18, 2021
1 parent 0edfad0 commit fab1c35
Show file tree
Hide file tree
Showing 152 changed files with 63,877 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Nanobrok: Debugger",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--host",
"0.0.0.0",
"--port",
"8000"
],
"jinja": true
}
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"python.pythonPath": "venv/bin/python",
"html.suggest.html5": true,
"html.autoClosingTags": true,
"css.styleSheets": [
"nanobrok/css/style.css",
"/nanobrok/css/style.css",
"nanobrok/css/halfmoon.min.css",
"/nanobrok/css/halfmoon.min.css",
"${fileBasenameNoExtension}.css"
],
"files.associations": {
"*.html": "html"
},
"files.exclude": {
"**/*.pyc": {"when": "$(basename).py"},
"**/__pycache__": true,
},
"python.testing.unittestArgs": [
"-v",
"-s",
"./nanobrok",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": true
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## [Unreleased]

## [Version] - 2021-09-18

### Added

### Changed
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# pull official base image
FROM python:3.7-slim-buster


RUN apt-get update \
&& apt-get -y install libpq-dev gcc \
&& pip install psycopg2

# set work directory
WORKDIR /usr/src/app

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies

RUN pip install --upgrade pip
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

# copy project
COPY . /usr/src/app/
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
SHELL := /bin/bash
.PHONY: all clean install test

help:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

all: clean install test

#flask db stamp head
migrate:
flask db migrate
flask db upgrade
start:
source venv/bin/activate
flask run --host 0.0.0.0

test:
pytest nanobrok/tests -vs

format:
black nanobrok

install:
pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -r requirements_test.txt

clean:
@find . -name '*.pyc' -exec rm -rf {} \;
@find . -name '__pycache__' -exec rm -rf {} \;
@find . -name 'Thumbs.db' -exec rm -rf {} \;
@find . -name '*~' -exec rm -rf {} \;
rm -rf .cache
rm -rf build
rm -rf dist
rm -rf *.egg-info
rm -rf htmlcov
rm -rf .tox/
rm -rf docs/_build
84 changes: 82 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,82 @@
# nanobrok
this is a demo
# Nanobrok (Web Service)

**Web Service write in Python for control and protect your android device remotely.**

![Nanobrok](/docs/screenshot.png)

The official app can be found on the PlayStore:

- [NanobrokPro](https://play.google.com/store/apps/details?id=com.mh4x0f.nanobrok)
- [Nanobrok Community](https://play.google.com/store/apps/details?id=com.mh4x0f.community.nanobrok)

## Overview
**Nanobrok-Server** is powerful opensource webservice for control and protect your android device, written in Python, that allow and offer a stable and security connection with your android device for protect , control remotely.

## Main Features

- Maps the location of your device
- Alert flag (Event it's lost or stolen)
- Recorder Audio Mic
- Remote File Transfer [PRO]
- Network scanner [PRO]
- and **more**!

## Security features

We implemented some security features for try protect your remote server. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and I cannot guarantee its absolute security.

- CSRF token
- Sign-in attempt block limit
- X-Frame-Options
- Same origin policy (SOP)
- CORS flask implementation
- HTTPS force redirect
- API Header X-CSRFToken
- Self Signed Certificate (CA)

we are always looking to implement security features.

## Supported platforms

* **Python**: you need **Python 3.7 or later** to run Nanobrok-Server.
* You can run [localhost](https://github.com/P0cL4bs/Nanobrok/wiki/Installation#virtualenv), [VPS](https://github.com/P0cL4bs/Nanobrok/wiki/Installation#install-on-vps) or as [heroku app](https://github.com/P0cL4bs/Nanobrok/wiki/Installation#heroku).

* **Operating System**:
* a recent version of Linux (we tested on **Ubuntu 18.04 LTS**);
* please note: **Windows** is **supported** (was not tested yet)

## Installation & Documentation

Learn more about using [wiki](https://github.com/P0cL4bs/Nanobrok/wiki)

- [Installation](https://github.com/P0cL4bs/Nanobrok/wiki/Installation)

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for how to help out.


## Donation

##### Patreon:

[![patreon](https://img.shields.io/badge/donate-patreon-orange)](https://www.patreon.com/nanobrok?fan_landing=true)


##### paypal:

[![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=LJNKDUAT5LX4G)

##### Via BTC:

1HBXz6XX3LcHqUnaca5HRqq6rPUmA3pf6f


## community
on discord: https://discord.gg/gYjBryBu

## License

**Nanobrok** is licensed under the [Apche 2.0](./LICENSE.md).

Made with :heart: by P0cL4bs Team
54 changes: 54 additions & 0 deletions create-cert-nanobrok.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
reset='\033[0m' # Text Reset

VERSION="v1.0"
rootCA="NanobrokCA"
serverCA="serverNB"

display_help() {
echo "Usage: $0 <argument>" >&2
echo "Example: "
echo -e "$0 domains.ext"
exit 1
}

echo -e "Nanobrok Certificate authority (CA) generator"
echo -e "Version: $VERSION\n"

if [ -z "$1" ]; then
display_help
exit 1
fi

domains="$1"

if [ ! -f "$domains" ]; then
echo -e "${Red}ERROR: ${reset}The file $domains not found!"
echo -e "${Red}ERROR: ${reset} First, create a file domains.ext that lists all your local domains"
exit 1
fi

if ! command -v 'openssl' &> /dev/null
then
echo -e "${Yellow}Openssl: ${reset} openssl could not be found"
exit
fi

echo -e "${Yellow}Openssl: ${reset} Generate root (CA) ${rootCA}.pem, ${rootCA}.key & ${rootCA}.crt"
openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 -keyout ${rootCA}.key -out ${rootCA}.pem -subj "/C=US/CN=Nanobrok-Server-CA"
openssl x509 -outform pem -in ${rootCA}.pem -out ${rootCA}.crt

echo -e "${Yellow}Openssl: ${reset} Generate server (CA) ${serverCA}.key and ${serverCA}.csr"
openssl req -new -nodes -newkey rsa:2048 -keyout ${serverCA}.key -out ${serverCA}.csr -subj "/C=US/ST=State/L=City/O=Example-Certificates/CN=Nanobrok.server"
openssl x509 -req -sha256 -days 1024 -in ${serverCA}.csr -CA ${rootCA}.pem -CAkey ${rootCA}.key -CAcreateserial -extfile $domains -out ${serverCA}.crt
echo -e "${Blue}Info: ${reset} The self-signed certificates has been generated successfully."
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.0'

services:
web:
build: .
command: bash -c "flask create-db && flask populate-db && flask run -h 0.0.0.0"
volumes:
- /usr/src/app/
ports:
- 5000:5000
env_file:
- ./.env
depends_on:
- db
db:
image: postgres:13-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=hello_flask
- POSTGRES_PASSWORD=hello_flask
- POSTGRES_DB=hello_flask_dev

volumes:
postgres_data:
Binary file added docs/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added nanobrok/__init__.py
Empty file.
31 changes: 31 additions & 0 deletions nanobrok/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from flask import Flask
from nanobrok.ext import configuration

# This file is part of the Nanobrok Open Source Project.
# nanobrok is licensed under the Apache 2.0.

# Copyright 2021 p0cL4bs Team - Marcos Bomfim (mh4x0f)

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


def minimal_app(**config):
app = Flask(__name__)
configuration.init_app(app, **config)
return app


def create_app(**config):
app = minimal_app(**config)
configuration.load_extensions(app)
return app
Empty file added nanobrok/blueprints/__init__.py
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions nanobrok/blueprints/resources/resourceUtils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from flask import jsonify
from flask import make_response

# This file is part of the Nanobrok Open Source Project.
# nanobrok is licensed under the Apache 2.0.

# Copyright 2021 p0cL4bs Team - Marcos Bomfim (mh4x0f)

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


def build_message_done(code, msg, data):
return jsonify({"code": code, "message": msg, "data": data})


def build_api_response(code, msg, data):
return make_response(jsonify({"code": code, "message": msg, "data": data}), code)
Loading

0 comments on commit fab1c35

Please sign in to comment.