|
|
# Backend through URLs
|
|
|
|
|
|
The backend is developed to work completely autonomously. This is why you can use it without using the frontend, from a terminal
|
|
|
|
|
|
## Load the APIs
|
|
|
If you have running the frontend, you can load the APIs from the Api Keys menu
|
|
|
But if you did not install the frontend dependencies, you can load the APIs into the $HOMEIKY/backend/factories/apikeys.json file
|
|
|
If that file does not exist, you can generate it by copying from apikeys_default.json in the same dir
|
|
|
|
|
|
## Turn on Backend
|
|
|
Once the backend is installed and the API Keys are loaded you must run the backend processes as follows, within the project directory
|
|
|
|
|
|
### Redis : Terminal 1
|
|
|
```shell
|
|
|
cd backend
|
|
|
redis-server
|
|
|
```
|
|
|
### Celery : Terminal 2
|
|
|
```shell
|
|
|
cd backend
|
|
|
./celery
|
|
|
```
|
|
|
### Flask : Terminal 3
|
|
|
```shell
|
|
|
cd backend
|
|
|
python3 app.py
|
|
|
```
|
|
|
|
|
|
## Flask messages
|
|
|
The way to communicate with celery to run the collection processes is through URLs that Flask will interpret and process
|
|
|
|
|
|
### Tasklist proccess
|
|
|
The tasklist process returns all messages implemented to run the gatherer processes in the celery
|
|
|
```
|
|
|
curl http://127.0.0.1:5000/tasklist
|
|
|
```
|
|
|
Return
|
|
|
```json
|
|
|
{
|
|
|
"modules": [
|
|
|
"ghostproject",
|
|
|
"fullcontact",
|
|
|
"usersearch",
|
|
|
"socialscan",
|
|
|
"instagram",
|
|
|
"tasklist",
|
|
|
"linkedin",
|
|
|
"emailrep",
|
|
|
"testing",
|
|
|
"keybase",
|
|
|
"twitter",
|
|
|
"apikey",
|
|
|
"github",
|
|
|
"gitlab",
|
|
|
"leaks",
|
|
|
"result/<task_id>",
|
|
|
"state/<task_id>/<task_app>"
|
|
|
]
|
|
|
}
|
|
|
```
|
|
|
|
|
|
### Most modules
|
|
|
For most of the modules that tasklist returns
|
|
|
```
|
|
|
curl -d ‘{“username”:”user_or_email", "from":"Initial"}' -H "Content-Type: application/json" -X POST http://127.0.0.1:5000/module_name
|
|
|
```
|
|
|
Where user_or_email is the username or email address and module_name is the majority of the returned modules by tasklist
|
|
|
The JSON returned ( where module_name=github and username=xxx )
|
|
|
```json
|
|
|
{
|
|
|
"from_m": "Initial",
|
|
|
"module": "github",
|
|
|
"param": "xxx",
|
|
|
"task": "8d59905d-ae1f-434d-bde1-2414cbb3e94f"
|
|
|
}
|
|
|
```
|
|
|
## Get results
|
|
|
The backend provides two URLs to get the result. One of them reports the status of the task and another obtains the results
|
|
|
### Status of the task
|
|
|
To obtain the status you must run a GET as follows
|
|
|
```
|
|
|
curl http://127.0.0.1:5000/state/<task_id>/<task_app>
|
|
|
```
|
|
|
Following the example above
|
|
|
```
|
|
|
curl http://127.0.0.1:5000/state/8d59905d-ae1f-434d-bde1-2414cbb3e94f/github
|
|
|
```
|
|
|
```json
|
|
|
{
|
|
|
"state": "SUCCESS",
|
|
|
"task_app": "github",
|
|
|
"task_id": "8d59905d-ae1f-434d-bde1-2414cbb3e94f"
|
|
|
}
|
|
|
```
|
|
|
The state field is documented by celery in the following [link](https://docs.celeryproject.org/en/latest/reference/celery.states.html)
|
|
|
|
|
|
### Result of the task
|
|
|
To obtain the result you must run a GET as follows
|
|
|
```
|
|
|
curl http://127.0.0.1:5000/result/<task_id>
|
|
|
```
|
|
|
Following the example above
|
|
|
```
|
|
|
curl http://127.0.0.1:5000/result/8d59905d-ae1f-434d-bde1-2414cbb3e94f
|
|
|
```
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"result": [
|
|
|
{
|
|
|
"module": "github"
|
|
|
},
|
|
|
{
|
|
|
"param": "xxx"
|
|
|
},
|
|
|
{
|
|
|
"validation": "no"
|
|
|
},
|
|
|
{
|
|
|
"raw": { }
|
|
|
},
|
|
|
{
|
|
|
"graphic": [{ }, { }, { }]
|
|
|
},
|
|
|
{
|
|
|
"profile": [{ }, { }, { }]
|
|
|
},
|
|
|
{
|
|
|
"timeline": [{ }, { }, { }]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
```
|
|
|
Where
|
|
|
- *module* : It is the name of the module
|
|
|
- *param* : It is the parameter (user or email)
|
|
|
- *validation* : level of validation
|
|
|
- *raw* : JSON object returned by API or raw scraping
|
|
|
- *graphic* : JSON object array that are input to frontend graphics
|
|
|
- *profile* : JSON object array that compiles raw and profile related information
|
|
|
- name
|
|
|
- location
|
|
|
- photo
|
|
|
- organization
|
|
|
- RRSS
|
|
|
- *timeline* : JSON object array that compiles raw and chronologically sorted information and the structure is
|
|
|
```json
|
|
|
{
|
|
|
"action": "Github : Create Account",
|
|
|
"date": "2013/01/08 22:39:50",
|
|
|
"icon": "fab fa-github"
|
|
|
}
|
|
|
```
|
|
|
|
|
|
**Place nice** |
|
|
\ No newline at end of file |