Compare commits

...

11 Commits
v1.0 ... master

Author SHA1 Message Date
Francesco Esposito d56e9796d8
Merge pull request #5 from franjsco/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-07-19 16:55:41 +02:00
dependabot[bot] a4501e602c
Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-16 10:31:37 +00:00
franjsco 517d3ea4e9 update dirs/readme 2020-05-13 00:59:15 +02:00
Francesco Esposito 7137d41ac4 Edit username 2020-03-01 23:35:34 +01:00
Francesco Esposito da0ec71ba5
Merge pull request #3 from frsposito/dependabot/npm_and_yarn/lodash-4.17.15
Bump lodash from 4.17.11 to 4.17.15
2019-11-03 10:32:52 +01:00
Francesco Esposito 87fa508522
Merge pull request #2 from frsposito/dependabot/npm_and_yarn/js-yaml-3.13.1
Bump js-yaml from 3.12.0 to 3.13.1
2019-11-03 10:32:35 +01:00
dependabot[bot] e3df205956
Bump lodash from 4.17.11 to 4.17.15
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-03 09:32:01 +00:00
dependabot[bot] 3128b53f44
Bump js-yaml from 3.12.0 to 3.13.1
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-03 09:31:30 +00:00
Francesco Esposito 8a39821d89
Merge pull request #1 from frsposito/dependabot/npm_and_yarn/eslint-utils-1.4.3
Bump eslint-utils from 1.3.1 to 1.4.3
2019-11-03 10:27:26 +01:00
dependabot[bot] c3a9feb90b
Bump eslint-utils from 1.3.1 to 1.4.3
Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.3.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.3)

Signed-off-by: dependabot[bot] <support@github.com>
2019-10-29 12:55:22 +00:00
Francesco Esposito 3de24e30dc edit user ref 2019-07-23 22:21:23 +02:00
9 changed files with 769 additions and 629 deletions

View File

@ -1,12 +1,37 @@
# lscanbot
<h1 align="center">Welcome to lscanbot 📱</h1>
<p>
<a href="https://github.com/franjsco/lscanbot/graphs/commit-activity" target="_blank">
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
</a>
<a href="https://github.com/franjsco/lscanbot/blob/master/LICENSE" target="_blank">
<img alt="License: GPL--3.0" src="https://img.shields.io/github/license/franjsco/lscanbot" />
</a>
<a href="https://twitter.com/franjsco" target="_blank">
<img alt="Twitter: franjsco" src="https://img.shields.io/twitter/follow/franjsco.svg?style=social" />
</a>
</p>
An opensource telegram bot to find devices on your LAN.
> A telegram bot to find devices on your LAN.
<img src="screenshot.png" height="400">
<img src="screenshot.png">
The bot is written in Node.js.
## Install
### Step by step
1. Install **arp-scan** package on your GNU/Linux system.
2. Configure **arp-scan** to use without sudo. (`chmod u+s`)
3. Clone this repository on your system.
4. Install dependecies with `npm install`.
5. Create new bot with **@BotFather** on Telegram.
6. Insert your **API Token** (app.token) into `config.json`.
7. Insert your **Telegram ID** (app.authorizedUsers) into `config.json`.
8. Insert your **Network Device** (scanner.interface) into `config.json`.
## Usage
Start server:
```sh
npm run start
```
**lscanbot** scans devices with arp-scan, showing only devices registered in the inventory.
@ -16,8 +41,7 @@ Before scanning, you must insert the devices into the inventory (to track it):
(use `;` to split arguments)
example: (/add My device; Me; AB:CC:MY:MC:AD)
example: (/add Motorola Moto G6; Frank; AB:CC:MY:MC:AD)
@ -31,32 +55,23 @@ It will send back the devices connected to your network.
### Remove
> /remove [MAC Address]
## Installation
In order to use this bot is required that the code is hosted on a GNU/Linux system connected to your LAN (Raspberry Pi would be a good choice)
## Author
👤 **franjsco (Francesco Esposito)**
### Prerequisites
- Node.js
- npm
- GNU/Linux
* Website: https://franjsco.github.io/
* Twitter: [@franjsco](https://twitter.com/franjsco)
* Github: [@franjsco](https://github.com/franjsco)
### Step by step
1. Install **arp-scan** package on your linux system.
2. Configure arp-scan to use without sudo.
(`chmod u+s`)
3. Clone this repository on your system.
4. Install dependecies with `npm install`.
5. Create new bot with BotFather on Telegram.
6. Insert your **token** (app.token) into `config.json`.
7. Insert your **TelegramID** (app.authorizedUsers) into `config.json`.
8. Insert your **network device** (scanner.interface) into `config.json`.
8. Start with `npm start`.
## Show your support
Give a ⭐️ if this project helped you!
### License
## 📝 License
GPLv3
Copyright © 2020 [franjsco (Francesco Esposito)](https://github.com/franjsco).<br />
This project is [GPL--3.0](https://github.com/franjsco/lscanbot/blob/master/LICENSE) licensed.
---
Made with ❤️ by Francesco Esposito ([@frab1t](https://github.com/frab1t))
***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

1289
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,33 @@
{
"name": "lscanbot",
"version": "1.0.0",
"description": "A telegram bot to scan your LAN.",
"main": "index.js",
"description": "A telegram bot to find devices on your LAN.",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint .",
"start": "node index.js"
"start": "node src/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/frab1t/lscanbot.git"
"url": "git+https://github.com/franjsco/lscanbot.git"
},
"author": "frab1t",
"author": "franjsco",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/frab1t/lscanbot/issues"
"url": "https://github.com/franjsco/lscanbot/issues"
},
"homepage": "https://github.com/frab1t/lscanbot#readme",
"homepage": "https://github.com/franjsco/lscanbot#readme",
"dependencies": {
"arpscan": "^0.6.0",
"bunyan": "^1.8.12",
"network-list": "^1.1.5",
"sqlite3": "^4.0.2",
"telebot": "^1.2.6"
"telebot": "^1.3.0"
},
"devDependencies": {
"eslint": "^5.6.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0"
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.20.2"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

After

Width:  |  Height:  |  Size: 461 KiB

View File

@ -1,6 +1,6 @@
const sqlite3 = require('sqlite3').verbose();
const fs = require('fs');
const appConfig = require('./config.json');
const appConfig = require('../config.json');
function connectDB() {
const db = new sqlite3.Database('data.db');

View File

@ -1,5 +1,5 @@
const bunyan = require('bunyan');
const appConfig = require('./config.json');
const appConfig = require('../config.json');
const log = bunyan.createLogger({
name: appConfig.app.name,

View File

@ -1,5 +1,5 @@
const arpScanner = require('arpscan/promise');
const appConfig = require('./config.json');
const appConfig = require('../config.json');
const db = require('./db');
function scanNetwork(userId) {

View File

@ -1,5 +1,5 @@
const TeleBot = require('telebot');
const appConfig = require('./config.json');
const appConfig = require('../config.json');
const scanner = require('./scanner.js');
const utils = require('./utils.js');
const logger = require('./logger.js');

View File

@ -1,4 +1,4 @@
const appConfig = require('./config.json');
const appConfig = require('../config.json');
function isAuthorizedUser(userId) {
return appConfig.app.authorizedUsers.includes(userId);
@ -7,13 +7,13 @@ function isAuthorizedUser(userId) {
function templateStart() {
const msg = `* Welcome to ${appConfig.app.name} 📱📡*\n
A bot to find devices on your network. \n
Made with by @frab1t `;
Made with by @franjsco `;
return msg;
}
function templateUnauthorizedUser() {
const msg = `Unauthorized user. 🤖 \n
Clone the repository https://github.com/frab1t/lscanbot
Clone the repository https://github.com/franjsco/lscanbot
and run the bot on your local network. 😎`;
return msg;
}
@ -29,10 +29,10 @@ function templateHelp() {
}
function templateDevicesList(data) {
if(data.length === 0) {
if (data.length === 0) {
let devices = '📡 Devices Not Found. \n\n';
return devices;
}
}
let devices = '📡 Devices available: \n\n';
data.forEach((elem) => {
devices += `----- \n 📱 * ${elem.device} * \n 👉 _ ${elem.owner} _ \n \n `;