├── .env.example
├── .github
├── FUNDING.yml
├── assets
│ └── FUCKING_STOP.gif
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── requirements.txt
├── SECURITY.md
├── LICENSE
├── README.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── .gitignore
└── main.py
/.env.example:
--------------------------------------------------------------------------------
1 | TOKEN=YOUR_BOT_TOKEN_HERE
2 | GUILDID=YOUR_GUILD_HERE
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: ThatSINEWAVE
2 | ko_fi: thatsinewave
3 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThatSINEWAVE/IP-Lookup-Bot/HEAD/requirements.txt
--------------------------------------------------------------------------------
/.github/assets/FUCKING_STOP.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ThatSINEWAVE/IP-Lookup-Bot/HEAD/.github/assets/FUCKING_STOP.gif
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Project Security
4 |
5 |
6 |
7 | ## Security Policy
8 | We attach great importance to the security of our users data, but we are humans and not infallible.
9 | That's why we rely on you, the open source contributors, to inform us about actual and possible security vulnerabilities.
10 | Please follow the guideline below to get in touch with us, even if you're not sure, if your issue is regarding the data security.
11 |
12 | ## Reporting a Vulnerability
13 | **Please do not open GitHub issues for security vulnerabilities, as GitHub issues are publicly accessible!**
14 |
15 | Instead, contact us per mail ().
16 | We guarantee a response within two workdays and a security patch as fast as possible.
17 |
18 | Thanks for your cooperation and your understanding.
19 |
20 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 David
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # IP Information and Network Utilities Discord Bot
4 |
5 | 
6 |
7 | This is a Discord bot that provides various network utilities and IP information retrieval capabilities. It allows users to retrieve detailed information about IP addresses, perform DNS lookups, find shared DNS entries, conduct WHOIS queries, and make custom requests to APIs or web pages.
8 |
9 |
10 |
11 | ## Features
12 |
13 | - `/check ` to retrieve detailed information about the specified IP address, including country, city, region, geolocation, ISP, organization, and more.
14 |
15 | - `/request ` to make custom requests to any API or web page and display the response.
16 |
17 | - `/reversedns ` to perform a reverse DNS lookup.
18 |
19 | - `/dnslookup ` to perform a DNS lookup.
20 |
21 | - `/hostsearch ` to search for hosts sharing the same DNS.
22 |
23 | - `/shareddns ` to find shared DNS entries.
24 |
25 | - `/whois ` to perform a WHOIS lookup.
26 |
27 | - `/reverseip ` to perform a reverse IP lookup.
28 |
29 | - `/aslookup ` to perform an AS lookup.
30 |
31 | - `/ipgeo ` to retrieve IP geolocation information.
32 |
33 | - `/checkinvite ` to check discord invite links.
34 |
35 | - Logging of user information, commands, and bot responses in a `logger.txt` file.
36 |
37 | - Error handling for invalid inputs or API failures.
38 |
39 | ## Requirements
40 |
41 | - Python 3.9.x recommended
42 | - `discord.py==2.3.2`
43 | - `requests==2.26.0`
44 | - `python-whois==0.9.4`
45 | - `aiohttp==3.9.5`
46 | - `aiosignal==1.3.1`
47 | - `attrs==23.2.0`
48 | - `certifi==2024.2.2`
49 | - `charset-normalizer==2.0.12`
50 | - `discord-py-interactions==4.4.1`
51 | - `frozenlist==1.4.1`
52 | - `future==1.0.0`
53 | - `idna==3.7`
54 | - `multidict==6.0.5`
55 | - `python-dotenv==1.0.1`
56 | - `urllib3==1.26.18`
57 | - `yarl==1.9.4`
58 |
59 |
60 |
61 | ## ☕ [Support my work on Ko-Fi](https://ko-fi.com/thatsinewave)
62 |
63 |
64 |
65 | ## Installation
66 |
67 | 1. Clone the repository or download the source code.
68 |
69 | 2. Install the required dependencies by running `pip install -r requirements.txt`.
70 |
71 | 3. Create a new Discord bot and obtain the bot token.
72 |
73 | 4. Create a new Discord server or use an existing one, and obtain the server ID (Guild ID).
74 |
75 | 5. Create a `.env` file in the project directory, copy `.env.example` contents and paste in the new file.
76 | ```env
77 | TOKEN=YOUR_BOT_TOKEN_HERE
78 | GUILDID=YOUR_GUILD_HERE
79 | ```
80 |
81 | 6. Replace `TOKEN` with your bot token and `GUILDID` with your guild ID.
82 |
83 |
84 |
85 | # [Join my Discord server](https://thatsinewave.github.io/Discord-Redirect/)
86 |
87 |
88 |
89 | ## Usage
90 |
91 | 1. Run the `main.py` script to start the bot.
92 |
93 | 2. In your Discord server, use the various slash commands (e.g., `/check`, `/request`, `/reversedns`, etc.) to utilize the bot's network utilities and IP information retrieval capabilities.
94 |
95 | The bot will respond with the requested information or the API/web page response, and the responses will also be logged in the `logger.txt` file.
96 |
97 | ## Contributing
98 |
99 | Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
100 |
101 | ### Contributors
102 |
103 | - Thanks to [Nitrrine](https://github.com/Nitrrine) for various improvements and fixes.
104 |
105 | ## License
106 |
107 | This project is licensed under the [MIT License](LICENSE).
108 |
109 | ## Warning
110 |
111 | This bot is designed for educational and network analysis purposes only. Using this bot for malicious purposes, such as attempting to obtain sensitive information or compromising user privacy, is strictly prohibited and goes against Discord's Terms of Service. Any unauthorized or unethical use of this bot will not be tolerated.
112 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Code of Conduct - IP-Lookup-Bot
4 |
5 |
6 |
7 | ## Our Pledge
8 |
9 | In the interest of fostering an open and welcoming environment, we as
10 | contributors and maintainers pledge to make participation in our project and
11 | our community a harassment-free experience for everyone, regardless of age, body
12 | size, disability, ethnicity, sex characteristics, gender identity and expression,
13 | level of experience, education, socio-economic status, nationality, personal
14 | appearance, race, religion, or sexual identity and orientation.
15 |
16 | ## Our Standards
17 |
18 | Examples of behavior that contributes to a positive environment for our
19 | community include:
20 |
21 | * Demonstrating empathy and kindness toward other people
22 | * Being respectful of differing opinions, viewpoints, and experiences
23 | * Giving and gracefully accepting constructive feedback
24 | * Accepting responsibility and apologizing to those affected by our mistakes,
25 | and learning from the experience
26 | * Focusing on what is best not just for us as individuals, but for the
27 | overall community
28 |
29 | Examples of unacceptable behavior include:
30 |
31 | * The use of sexualized language or imagery, and sexual attention or
32 | advances
33 | * Trolling, insulting or derogatory comments, and personal or political attacks
34 | * Public or private harassment
35 | * Publishing others' private information, such as a physical or email
36 | address, without their explicit permission
37 | * Other conduct which could reasonably be considered inappropriate in a
38 | professional setting
39 |
40 | ## Our Responsibilities
41 |
42 | Project maintainers are responsible for clarifying and enforcing our standards of
43 | acceptable behavior and will take appropriate and fair corrective action in
44 | response to any behavior that they deem inappropriate,
45 | threatening, offensive, or harmful.
46 |
47 | Project maintainers have the right and responsibility to remove, edit, or reject
48 | comments, commits, code, wiki edits, issues, and other contributions that are
49 | not aligned to this Code of Conduct, and will
50 | communicate reasons for moderation decisions when appropriate.
51 |
52 | ## Scope
53 |
54 | This Code of Conduct applies within all community spaces, and also applies when
55 | an individual is officially representing the community in public spaces.
56 | Examples of representing our community include using an official e-mail address,
57 | posting via an official social media account, or acting as an appointed
58 | representative at an online or offline event.
59 |
60 | ## Enforcement
61 |
62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
63 | reported to the community leaders responsible for enforcement at .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org/), version
118 | [1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct/code_of_conduct.md) and
119 | [2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct/code_of_conduct.md)
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Contributing to IP-Lookup-Bot
4 |
5 |
6 |
7 | First off, thanks for taking the time to contribute! ❤️
8 |
9 | All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
10 |
11 | > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
12 | > - Star the project
13 | > - Tweet about it
14 | > - Refer this project in your project's readme
15 | > - Mention the project at local meetups and tell your friends/colleagues
16 |
17 | ## Table of Contents
18 |
19 | - [Code of Conduct](#code-of-conduct)
20 | - [I Have a Question](#i-have-a-question)
21 | - [I Want To Contribute](#i-want-to-contribute)
22 | - [Reporting Bugs](#reporting-bugs)
23 | - [Suggesting Enhancements](#suggesting-enhancements)
24 | - [Your First Code Contribution](#your-first-code-contribution)
25 | - [Improving The Documentation](#improving-the-documentation)
26 | - [Styleguides](#styleguides)
27 | - [Commit Messages](#commit-messages)
28 | - [Join The Project Team](#join-the-project-team)
29 |
30 | ## Code of Conduct
31 |
32 | This project and everyone participating in it is governed by the
33 | [IP-Lookup-Bot Code of Conduct](https://github.com/ThatSINEWAVE/IP-Lookup-Botblob/master/CODE_OF_CONDUCT.md).
34 | By participating, you are expected to uphold this code. Please report unacceptable behavior
35 | to .
36 |
37 | ## I Have a Question
38 |
39 | > If you want to ask a question, we assume that you have read the available [Documentation]().
40 |
41 | Before you ask a question, it is best to search for existing [Issues](https://github.com/ThatSINEWAVE/IP-Lookup-Bot/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
42 |
43 | If you then still feel the need to ask a question and need clarification, we recommend the following:
44 |
45 | - Open an [Issue](https://github.com/ThatSINEWAVE/IP-Lookup-Bot/issues/new).
46 | - Provide as much context as you can about what you're running into.
47 | - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
48 |
49 | We will then take care of the issue as soon as possible.
50 |
51 | ## I Want To Contribute
52 |
53 | > ### Legal Notice
54 | > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license.
55 |
56 | ### Reporting Bugs
57 |
58 | #### Before Submitting a Bug Report
59 |
60 | A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
61 |
62 | - Make sure that you are using the latest version.
63 | - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)).
64 | - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/ThatSINEWAVE/IP-Lookup-Botissues?q=label%3Abug).
65 | - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
66 | - Collect information about the bug:
67 | - Stack trace (Traceback)
68 | - OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
69 | - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
70 | - Possibly your input and the output
71 | - Can you reliably reproduce the issue? And can you also reproduce it with older versions?
72 |
73 | #### How Do I Submit a Good Bug Report?
74 |
75 | > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to .
76 |
77 | We use GitHub issues to track bugs and errors. If you run into an issue with the project:
78 |
79 | - Open an [Issue](https://github.com/ThatSINEWAVE/IP-Lookup-Bot/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
80 | - Explain the behavior you would expect and the actual behavior.
81 | - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
82 | - Provide the information you collected in the previous section.
83 |
84 | Once it's filed:
85 |
86 | - The project team will label the issue accordingly.
87 | - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
88 | - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
89 |
90 | ### Suggesting Enhancements
91 |
92 | This section guides you through submitting an enhancement suggestion for IP-Lookup-Bot, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
93 |
94 | #### Before Submitting an Enhancement
95 |
96 | - Make sure that you are using the latest version.
97 | - Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration.
98 | - Perform a [search](https://github.com/ThatSINEWAVE/IP-Lookup-Bot/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
99 | - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
100 |
101 | #### How Do I Submit a Good Enhancement Suggestion?
102 |
103 | Enhancement suggestions are tracked as [GitHub issues](https://github.com/ThatSINEWAVE/IP-Lookup-Bot/issues).
104 |
105 | - Use a **clear and descriptive title** for the issue to identify the suggestion.
106 | - Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
107 | - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
108 | - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
109 | - **Explain why this enhancement would be useful** to most IP-Lookup-Bot users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
110 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2 | # Created by https://www.toptal.com/developers/gitignore/api/venv,python,pycharm,visualstudiocode
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=venv,python,pycharm,visualstudiocode
4 |
5 | ### PyCharm ###
6 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
7 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
8 |
9 | # User-specific stuff
10 | .idea/**/workspace.xml
11 | .idea/**/tasks.xml
12 | .idea/**/usage.statistics.xml
13 | .idea/**/dictionaries
14 | .idea/**/shelf
15 |
16 | # AWS User-specific
17 | .idea/**/aws.xml
18 |
19 | # Generated files
20 | .idea/**/contentModel.xml
21 |
22 | # Sensitive or high-churn files
23 | .idea/**/dataSources/
24 | .idea/**/dataSources.ids
25 | .idea/**/dataSources.local.xml
26 | .idea/**/sqlDataSources.xml
27 | .idea/**/dynamic.xml
28 | .idea/**/uiDesigner.xml
29 | .idea/**/dbnavigator.xml
30 |
31 | # Gradle
32 | .idea/**/gradle.xml
33 | .idea/**/libraries
34 |
35 | # Gradle and Maven with auto-import
36 | # When using Gradle or Maven with auto-import, you should exclude module files,
37 | # since they will be recreated, and may cause churn. Uncomment if using
38 | # auto-import.
39 | # .idea/artifacts
40 | # .idea/compiler.xml
41 | # .idea/jarRepositories.xml
42 | # .idea/modules.xml
43 | # .idea/*.iml
44 | # .idea/modules
45 | # *.iml
46 | # *.ipr
47 |
48 | # CMake
49 | cmake-build-*/
50 |
51 | # Mongo Explorer plugin
52 | .idea/**/mongoSettings.xml
53 |
54 | # File-based project format
55 | *.iws
56 |
57 | # IntelliJ
58 | out/
59 |
60 | # mpeltonen/sbt-idea plugin
61 | .idea_modules/
62 |
63 | # JIRA plugin
64 | atlassian-ide-plugin.xml
65 |
66 | # Cursive Clojure plugin
67 | .idea/replstate.xml
68 |
69 | # SonarLint plugin
70 | .idea/sonarlint/
71 |
72 | # Crashlytics plugin (for Android Studio and IntelliJ)
73 | com_crashlytics_export_strings.xml
74 | crashlytics.properties
75 | crashlytics-build.properties
76 | fabric.properties
77 |
78 | # Editor-based Rest Client
79 | .idea/httpRequests
80 |
81 | # Android studio 3.1+ serialized cache file
82 | .idea/caches/build_file_checksums.ser
83 |
84 | ### PyCharm Patch ###
85 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
86 |
87 | # *.iml
88 | # modules.xml
89 | # .idea/misc.xml
90 | # *.ipr
91 |
92 | # Sonarlint plugin
93 | # https://plugins.jetbrains.com/plugin/7973-sonarlint
94 | .idea/**/sonarlint/
95 |
96 | # SonarQube Plugin
97 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
98 | .idea/**/sonarIssues.xml
99 |
100 | # Markdown Navigator plugin
101 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
102 | .idea/**/markdown-navigator.xml
103 | .idea/**/markdown-navigator-enh.xml
104 | .idea/**/markdown-navigator/
105 |
106 | # Cache file creation bug
107 | # See https://youtrack.jetbrains.com/issue/JBR-2257
108 | .idea/$CACHE_FILE$
109 |
110 | # CodeStream plugin
111 | # https://plugins.jetbrains.com/plugin/12206-codestream
112 | .idea/codestream.xml
113 |
114 | # Azure Toolkit for IntelliJ plugin
115 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
116 | .idea/**/azureSettings.xml
117 |
118 | ### Python ###
119 | # Byte-compiled / optimized / DLL files
120 | __pycache__/
121 | *.py[cod]
122 | *$py.class
123 |
124 | # C extensions
125 | *.so
126 |
127 | # Distribution / packaging
128 | .Python
129 | build/
130 | develop-eggs/
131 | dist/
132 | downloads/
133 | eggs/
134 | .eggs/
135 | lib/
136 | lib64/
137 | parts/
138 | sdist/
139 | var/
140 | wheels/
141 | share/python-wheels/
142 | *.egg-info/
143 | .installed.cfg
144 | *.egg
145 | MANIFEST
146 |
147 | # PyInstaller
148 | # Usually these files are written by a python script from a template
149 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
150 | *.manifest
151 | *.spec
152 |
153 | # Installer logs
154 | pip-log.txt
155 | pip-delete-this-directory.txt
156 |
157 | # Unit test / coverage reports
158 | htmlcov/
159 | .tox/
160 | .nox/
161 | .coverage
162 | .coverage.*
163 | .cache
164 | nosetests.xml
165 | coverage.xml
166 | *.cover
167 | *.py,cover
168 | .hypothesis/
169 | .pytest_cache/
170 | cover/
171 |
172 | # Translations
173 | *.mo
174 | *.pot
175 |
176 | # Django stuff:
177 | *.log
178 | local_settings.py
179 | db.sqlite3
180 | db.sqlite3-journal
181 |
182 | # Flask stuff:
183 | instance/
184 | .webassets-cache
185 |
186 | # Scrapy stuff:
187 | .scrapy
188 |
189 | # Sphinx documentation
190 | docs/_build/
191 |
192 | # PyBuilder
193 | .pybuilder/
194 | target/
195 |
196 | # Jupyter Notebook
197 | .ipynb_checkpoints
198 |
199 | # IPython
200 | profile_default/
201 | ipython_config.py
202 |
203 | # pyenv
204 | # For a library or package, you might want to ignore these files since the code is
205 | # intended to run in multiple environments; otherwise, check them in:
206 | # .python-version
207 |
208 | # pipenv
209 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
210 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
211 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
212 | # install all needed dependencies.
213 | #Pipfile.lock
214 |
215 | # poetry
216 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
217 | # This is especially recommended for binary packages to ensure reproducibility, and is more
218 | # commonly ignored for libraries.
219 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
220 | #poetry.lock
221 |
222 | # pdm
223 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
224 | #pdm.lock
225 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
226 | # in version control.
227 | # https://pdm.fming.dev/#use-with-ide
228 | .pdm.toml
229 |
230 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
231 | __pypackages__/
232 |
233 | # Celery stuff
234 | celerybeat-schedule
235 | celerybeat.pid
236 |
237 | # SageMath parsed files
238 | *.sage.py
239 |
240 | # Environments
241 | .env
242 | .venv
243 | env/
244 | venv/
245 | ENV/
246 | env.bak/
247 | venv.bak/
248 |
249 | # Spyder project settings
250 | .spyderproject
251 | .spyproject
252 |
253 | # Rope project settings
254 | .ropeproject
255 |
256 | # mkdocs documentation
257 | /site
258 |
259 | # mypy
260 | .mypy_cache/
261 | .dmypy.json
262 | dmypy.json
263 |
264 | # Pyre type checker
265 | .pyre/
266 |
267 | # pytype static type analyzer
268 | .pytype/
269 |
270 | # Cython debug symbols
271 | cython_debug/
272 |
273 | # PyCharm
274 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
275 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
276 | # and can be added to the global gitignore or merged into this file. For a more nuclear
277 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
278 | #.idea/
279 |
280 | ### Python Patch ###
281 | # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
282 | poetry.toml
283 |
284 | # ruff
285 | .ruff_cache/
286 |
287 | # LSP config files
288 | pyrightconfig.json
289 |
290 | ### venv ###
291 | # Virtualenv
292 | # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
293 | [Bb]in
294 | [Ii]nclude
295 | [Ll]ib
296 | [Ll]ib64
297 | [Ll]ocal
298 | [Ss]cripts
299 | pyvenv.cfg
300 | pip-selfcheck.json
301 |
302 | ### VisualStudioCode ###
303 | .vscode/*
304 | !.vscode/settings.json
305 | !.vscode/tasks.json
306 | !.vscode/launch.json
307 | !.vscode/extensions.json
308 | !.vscode/*.code-snippets
309 |
310 | # Local History for Visual Studio Code
311 | .history/
312 |
313 | # Built Visual Studio Code Extensions
314 | *.vsix
315 |
316 | ### VisualStudioCode Patch ###
317 | # Ignore all local history of files
318 | .history
319 | .ionide
320 |
321 | # End of https://www.toptal.com/developers/gitignore/api/venv,python,pycharm,visualstudiocode
322 |
323 | # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
324 |
325 | logger.txt
326 | /.idea
327 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import discord
2 | from discord.ext import commands
3 | import requests
4 | import json
5 | import logging
6 | import whois
7 | from dotenv import dotenv_values
8 |
9 | intents = discord.Intents.default()
10 | intents.messages = True
11 | intents.guilds = True
12 |
13 | # Configure logging
14 | logging.basicConfig(filename='logger.txt', level=logging.INFO,
15 | format='%(asctime)s [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
16 |
17 | # Read config from .env
18 | config = dotenv_values(".env")
19 |
20 | # Access token and guild ID
21 | TOKEN = config.get('TOKEN')
22 | GUILD_ID = int(config.get('GUILDID'))
23 | bot = commands.Bot(command_prefix='/', intents=intents)
24 |
25 | API_BASE_URL = 'https://api.hackertarget.com/'
26 |
27 |
28 | @bot.event
29 | async def on_ready():
30 | print(f'Logged in as {bot.user.name}')
31 | await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="networks"))
32 |
33 | # Sync the slash commands with Discord
34 | await bot.tree.sync()
35 |
36 |
37 | async def print_error(e: Exception, interaction: discord.Interaction):
38 | error_msg = f'Error: {e}'
39 | logging.error(error_msg)
40 | await interaction.response.send_message(error_msg)
41 |
42 |
43 | @bot.tree.command(name='check', description="Check any IP")
44 | async def check_ip_info(interaction: discord.Interaction, ip_address: str):
45 | try:
46 | # Log user information
47 | user_info = f'User: {interaction.user.name} (ID: {interaction.user.id})'
48 | logging.info(user_info)
49 |
50 | # Make a request to ip-api.com
51 | response = requests.get(
52 | f'http://ip-api.com/json/{ip_address}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,isp,org,as,asname,reverse,mobile,proxy,hosting,query')
53 | data = response.json()
54 |
55 | # Check if the request was successful
56 | if data['status'] == 'fail':
57 | raise Exception(data.get('message', 'Unknown error'))
58 |
59 | # Extract relevant information
60 | country = data.get('country', 'N/A')
61 | city = data.get('city', 'N/A')
62 | region = data.get('regionName', 'N/A')
63 | district = data.get('district', 'N/A')
64 | zip_code = data.get('zip', 'N/A')
65 | latitude = data.get('lat', 'N/A')
66 | longitude = data.get('lon', 'N/A')
67 | timezone = data.get('timezone', 'N/A')
68 | isp = data.get('isp', 'N/A')
69 | org = data.get('org', 'N/A')
70 | as_number = data.get('as', 'N/A')
71 | as_name = data.get('asname', 'N/A')
72 | reverse_dns = data.get('reverse', 'N/A')
73 | mobile = data.get('mobile', 'N/A')
74 | proxy = data.get('proxy', 'N/A')
75 | hosting = data.get('hosting', 'N/A')
76 |
77 | # Format and send the response with detailed information
78 | response_msg = (
79 | f'## IP Information for {ip_address}:\n'
80 | f'**Country:** {country}\n'
81 | f'**City:** {city}\n'
82 | f'**Region:** {region}\n'
83 | f'**District:** {district}\n'
84 | f'**Zip Code:** {zip_code}\n'
85 | f'**Latitude:** {latitude}\n'
86 | f'**Longitude:** {longitude}\n'
87 | f'**Timezone:** {timezone}\n'
88 | f'**ISP:** {isp}\n'
89 | f'**Organization:** {org}\n'
90 | f'**AS Number:** {as_number}\n'
91 | f'**AS Name:** {as_name}\n'
92 | f'**Reverse DNS:** {reverse_dns}\n'
93 | f'**Mobile:** {mobile}\n'
94 | f'**Proxy:** {proxy}\n'
95 | f'**Hosting:** {hosting}'
96 | )
97 |
98 | # Log the response
99 | logging.info(response_msg)
100 |
101 | # Send the response to the user
102 | await interaction.response.send_message(response_msg)
103 | except Exception as e:
104 | await print_error(e, interaction)
105 |
106 |
107 | @bot.tree.command(name='request', description="Make a request to any API or webpage")
108 | async def make_request(interaction: discord.Interaction, url: str):
109 | try:
110 | # Log user information
111 | user_info = f'User: {interaction.user.name} (ID: {interaction.user.id})'
112 | logging.info(user_info)
113 |
114 | # Make the request
115 | response = requests.get(url)
116 |
117 | # Check if the request was successful
118 | if response.status_code == 200:
119 | # If the response is JSON, format it nicely
120 | try:
121 | response_data = response.json()
122 | output = f'```json\n{json.dumps(response_data, indent=4)}\n```'
123 | except json.JSONDecodeError:
124 | # If not JSON, display the raw response
125 | output = f'```\n{response.text}\n```'
126 | else:
127 | output = f'Error: {response.status_code} - {response.reason}'
128 |
129 | # Log the response
130 | logging.info(output)
131 |
132 | # Send the response to the user
133 | await interaction.response.send_message(output)
134 | except Exception as e:
135 | await print_error(e, interaction)
136 |
137 |
138 | @bot.tree.command(name='reversedns', description="Perform reverse DNS lookup")
139 | async def reversedns_lookup(interaction: discord.Interaction, input_ip: str):
140 | try:
141 | response = requests.get(API_BASE_URL + f'reversedns/?q={input_ip}')
142 | output = f'```\n{response.text}\n```'
143 | await interaction.response.send_message(output)
144 | except Exception as e:
145 | await print_error(e, interaction)
146 |
147 |
148 | @bot.tree.command(name='dnslookup', description="Perform DNS lookup")
149 | async def dns_lookup(interaction: discord.Interaction, input_domain: str):
150 | try:
151 | response = requests.get(API_BASE_URL + f'dnslookup/?q={input_domain}')
152 | output = f'```\n{response.text}\n```'
153 | await interaction.response.send_message(output)
154 | except Exception as e:
155 | await print_error(e, interaction)
156 |
157 |
158 | @bot.tree.command(name='hostsearch', description="Search for hosts sharing the same DNS")
159 | async def host_search(interaction: discord.Interaction, input_domain: str):
160 | try:
161 | response = requests.get(API_BASE_URL + f'hostsearch/?q={input_domain}')
162 | output = f'```\n{response.text}\n```'
163 | await interaction.response.send_message(output)
164 | except Exception as e:
165 | await print_error(e, interaction)
166 |
167 |
168 | @bot.tree.command(name='shareddns', description="Find shared DNS entries")
169 | async def shared_dns(interaction: discord.Interaction, input_dns: str):
170 | try:
171 | response = requests.get(API_BASE_URL + f'findshareddns/?q={input_dns}')
172 | output = f'```\n{response.text}\n```'
173 | await interaction.response.send_message(output)
174 | except Exception as e:
175 | await print_error(e, interaction)
176 |
177 |
178 | @bot.tree.command(name='whois', description="Perform WHOIS lookup")
179 | async def whois_lookup(interaction: discord.Interaction, input_domain_or_ip: str):
180 | try:
181 | whois_info = dict(whois.whois(input_domain_or_ip))
182 | whois_output = ''
183 | for key, value in whois_info.items():
184 | whois_output += f'{key.replace("_", " ").title()}: {value}\n'
185 | output = f"```{whois_output}```"
186 | await interaction.response.send_message(output.replace("[", "").replace("]", "").replace("'", ""))
187 | except Exception as e:
188 | await print_error(e, interaction)
189 |
190 |
191 | @bot.tree.command(name='reverseip', description="Perform reverse IP lookup")
192 | async def reverse_ip_lookup(interaction: discord.Interaction, input_ip: str):
193 | try:
194 | response = requests.get(
195 | API_BASE_URL + f'reverseiplookup/?q={input_ip}')
196 | output = f'```\n{response.text}\n```'
197 | await interaction.response.send_message(output)
198 | except Exception as e:
199 | await print_error(e, interaction)
200 |
201 |
202 | @bot.tree.command(name='aslookup', description="Perform AS lookup")
203 | async def as_lookup(interaction: discord.Interaction, input_ip_or_as: str):
204 | try:
205 | response = requests.get(API_BASE_URL + f'aslookup/?q={input_ip_or_as}')
206 | output = f'```\n{response.text}\n```'
207 | await interaction.response.send_message(output)
208 | except Exception as e:
209 | await print_error(e, interaction)
210 |
211 |
212 | @bot.tree.command(name='ipgeo', description="Get IP geolocation information")
213 | async def ip_geolocation(interaction: discord.Interaction, input_ip: str):
214 | try:
215 | response = requests.get(API_BASE_URL + f'ipgeo/?q={input_ip}')
216 | output = f'```\n{response.text}\n```'
217 | await interaction.response.send_message(output)
218 | except Exception as e:
219 | await print_error(e, interaction)
220 |
221 |
222 | @bot.tree.command(name='checkinvite', description="Check Discord invite")
223 | async def check_invite(interaction: discord.Interaction, invite_link: str):
224 | try:
225 | # Extract invite code from the link
226 | invite_code = invite_link.split('/')[-1]
227 |
228 | # Make a request to Discord API to get invite information
229 | response = requests.get(f'https://discord.com/api/v9/invites/{invite_code}')
230 | data = response.json()
231 |
232 | # Check if the request was successful
233 | if 'guild' in data:
234 | # Extract guild information
235 | guild_info = data['guild']
236 | guild_name = guild_info.get('name', 'Not found')
237 | guild_id = guild_info.get('id', 'Not found')
238 | guild_splash = guild_info.get('splash', 'Not found')
239 | guild_banner = guild_info.get('banner', 'Not found')
240 | guild_description = guild_info.get('description', 'Not found')
241 | guild_icon = guild_info.get('icon', 'Not found')
242 | guild_features = ', '.join(guild_info.get('features', ['Not found']))
243 | guild_verification_level = guild_info.get('verification_level', 'Not found')
244 | guild_vanity_url_code = guild_info.get('vanity_url_code', 'Not found')
245 | guild_nsfw_level = guild_info.get('nsfw_level', 'Not found')
246 | guild_nsfw = guild_info.get('nsfw', 'Not found')
247 | guild_premium_subscription_count = guild_info.get('premium_subscription_count', 'Not found')
248 |
249 | # Extract channel information
250 | channel_info = data['channel']
251 | channel_id = channel_info.get('id', 'Not found')
252 | channel_type = channel_info.get('type', 'Not found')
253 | channel_name = channel_info.get('name', 'Not found')
254 |
255 | # Format and send the response with invite information
256 | invite_info_msg = (
257 | f'**Guild Name:** {guild_name}\n'
258 | f'**Guild ID:** {guild_id}\n'
259 | f'**Guild Splash:** {guild_splash}\n'
260 | f'**Guild Banner:** {guild_banner}\n'
261 | f'**Guild Description:** {guild_description}\n'
262 | f'**Guild Icon:** {guild_icon}\n'
263 | f'**Guild Features:** {guild_features}\n'
264 | f'**Guild Verification Level:** {guild_verification_level}\n'
265 | f'**Guild Vanity URL Code:** {guild_vanity_url_code}\n'
266 | f'**Guild NSFW Level:** {guild_nsfw_level}\n'
267 | f'**Guild NSFW:** {guild_nsfw}\n'
268 | f'**Guild Premium Subscription Count:** {guild_premium_subscription_count}\n'
269 | f'**Channel ID:** {channel_id}\n'
270 | f'**Channel Type:** {channel_type}\n'
271 | f'**Channel Name:** {channel_name}\n'
272 | f'**Invite URL:** `{invite_link}`'
273 | )
274 |
275 | # Log the response
276 | logging.info(invite_info_msg)
277 |
278 | # Send the response to the user
279 | await interaction.response.send_message(invite_info_msg)
280 | else:
281 | # If the request was not successful, send an error message
282 | error_msg = "Error retrieving invite info. Please check the invite link and try again."
283 | logging.error(error_msg)
284 | await interaction.response.send_message(error_msg)
285 | except Exception as e:
286 | await print_error(e, interaction)
287 |
288 |
289 | # Run the bot with the token
290 | bot.run(TOKEN)
--------------------------------------------------------------------------------