Skip to content

Commit

Permalink
various fixes and enhancements x2
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBoombastic committed Mar 24, 2023
1 parent 4294413 commit a42aee6
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
File renamed without changes.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Using this on a user account is prohibited by the Discord TOS and can lead to th
## Usage:

- By using binaries:
- Download binary from [Releases](https://github.com/MrBoombastic/OSINTCord/releases) tab.
- Download binary from the [Releases](https://github.com/MrBoombastic/OSINTCord/releases) tab.
- Fill in the `.env` file.
- Run the binary.
- By using source code:
Expand All @@ -23,23 +23,26 @@ Using this on a user account is prohibited by the Discord TOS and can lead to th
- Fill in the `.env` file and place it in `src` directory.
- Run `npm start`.

All results will be stored in the `logs` and `media` directories.

## Options:

You can use some default options from [.env.example](.env.example).
You can use some default options from the already provided [.env](.env) file.

- When using "MEMBERS" mode:
- When you want to dump guild members, set `MODE` to `MEMBERS` and set
- `GUILD_ID`: The guild ID you want to get data from.
- `CHANNEL_ID`: The channel ID, which also will be used to get data from.
- `SPACING`: Spacing between columns in output file.
- `TOKEN`: Your Discord account token.
- `DELAY`: Delay between *some* requests.
- `DICTIONARY`: Characters used by the bruteforce method. Case-insensitive, duplicates are ignored.
- `DICTIONARY`: Characters used by the bruteforce method. Case-insensitive, duplicates are ignored, sorted
alphabetically.
- `DATE_FORMAT`: format of the parsed date (refer to
the [Day.js manual](https://day.js.org/docs/en/display/format)).
- `DATE_LOCALE`: locale used in the parsed
date ([list of supported locales](https://github.com/iamkun/dayjs/tree/dev/src/locale)).
- When using "WATCHDOG" mode:
- `GUILD_ID`: The guild ID you want to get data from. Set to `all`, if you want to receive data from all members'
- When you want to trace deleted and edited messages, set `MODE` to `WATCHDOG` and set
- `GUILD_ID`: The guild ID you want to get data from. Set to `all`, if you want to receive data from all available
guilds.
- `TOKEN`: Your Discord account token.

Expand Down
3 changes: 2 additions & 1 deletion src/events/members/ready.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {welcome, exit} = require("../../utils");
const {welcome, exit, saveMembers} = require("../../utils");
const {perms, overlap, bruteforce} = require("../../steps");

module.exports = async (client) => {
Expand All @@ -24,5 +24,6 @@ module.exports = async (client) => {

// Done!
console.log(`Fetching done! Found ${guild.members.cache.size}/${guild.memberCount} => ${guild.members.cache.size / guild.memberCount * 100}% members.`);
saveMembers(client, guild);
exit(client);
};
2 changes: 1 addition & 1 deletion src/events/watchdog/messageDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ module.exports = async (client, message) => {
downloadFile(x.proxyURL);
});
}
client.logger.info(info);
client.logger.log(info);
}
};
3 changes: 2 additions & 1 deletion src/events/watchdog/messageUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const {downloadFile} = require("../../utils");

module.exports = async (client, oldMsg, newMsg) => {
if (oldMsg.guildId === process.env.GUILD_ID || process.env.GUILD_ID.toLowerCase() === "all") {
if (oldMsg.embeds.length === 0 && newMsg.embeds.length > 0) return; //ignoring generating thumbnails for images
let info = `[EDITED MESSAGE] Guild: ${oldMsg.guild.name} Channel: ${oldMsg.channel.name} Author: ${oldMsg.author?.tag} Bot: ${oldMsg.author?.bot}
OLD CONTENT: ${oldMsg.content}
NEW CONTENT: ${newMsg.content}`;
Expand All @@ -13,6 +14,6 @@ NEW CONTENT: ${newMsg.content}`;
downloadFile(x.proxyURL);
});
}
client.logger.info(info);
client.logger.log(info);
}
};
2 changes: 1 addition & 1 deletion src/events/watchdog/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = async (client) => {
watchdog: {
type: "file",
layout: {type: "pattern", pattern: "[%d] %m%n"},
filename: `${process.env.GUILD_ID}.log`
filename: `logs/watchdog-${process.env.GUILD_ID}.log`
}
},
categories: {default: {appenders: ["watchdog"], level: "info"}},
Expand Down
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
const {Client} = require("discord.js-selfbot-v13");
global.dayjs = require("dayjs");
dayjs.extend(require("dayjs/plugin/localizedFormat"));
const {checkConfig, exit} = require("./utils.js");
const {saveMembers} = require("./utils");
const {checkConfig, exit, saveMembers} = require("./utils.js");
require('dotenv').config();


// Setting up client
const client = new Client({
checkUpdate: false, partials: ["GUILD_MEMBER"]
checkUpdate: false,
});

// Config file validation
Expand Down Expand Up @@ -39,7 +38,7 @@ for (const file of events[process.env.MODE.toLowerCase()]) {

process.on("SIGINT", async () => {
console.log("\nStopping at user's request!");
if (process.env.MODE === "MEMBERS") saveMembers(client, client.guilds.cache.get(process.env.GUILD_ID));
if (process.env.MODE.toLowerCase() === "members") saveMembers(client, client.guilds.cache.get(process.env.GUILD_ID));
exit(client);
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
data += guild.members.cache.map(member => module.exports.formatUserData(member, process.env.SPACING, process.env.DATE_FORMAT)).join("\n");

// Save to file
const filename = `members-${Date.now()}.txt`;
const filename = `logs/members-${guild.id}-${Date.now()}.txt`;
try {
fs.writeFileSync(filename, data);
console.log(`Saved data to ${filename}!`);
Expand Down

0 comments on commit a42aee6

Please sign in to comment.