Skip to content
This repository was archived by the owner on Nov 4, 2023. It is now read-only.

Commit a283490

Browse files
authored
Merge pull request #26 from michael2to3/feature/docker
Add support docker
2 parents eb130e3 + 1dca0e6 commit a283490

File tree

4 files changed

+16
-60
lines changed

4 files changed

+16
-60
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -624,3 +624,4 @@ config.properties
624624
test.prop
625625
test.properties
626626
log4j.properties
627+
.env

Dockerfile

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM openjdk:11-jre-slim-buster
1+
FROM adoptopenjdk/openjdk16:alpine-jre
22
WORKDIR /app
3-
COPY . /app
4-
RUN ./gradlew build
5-
CMD ["java", "-jar", "app/build/libs/c2-search-netlas-1.0-SNAPSHOT.jar"]
3+
COPY ./app/build/libs/app-all.jar app.jar
4+
ENTRYPOINT ["java", "-jar", "app.jar"]

README.md

+12-49
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@ After acquiring your API key, execute the following command to search servers:
2020
```bash
2121
c2detect -t <TARGET_DOMAIN> -p <TARGET_PORT> -s <API_KEY> [-v]
2222
```
23-
2423
Replace `<TARGET_DOMAIN>` with the desired IP address or domain, `<TARGET_PORT>` with the port you wish to scan, and `<API_KEY>` with your Netlas API key.
25-
2624
Use the optional `-v` flag for verbose output.
27-
2825
For example, to search at the `google.com` IP address on port `443` using the Netlas API key `1234567890abcdef`, enter:
29-
3026
```bash
3127
c2detect -t google.com -p 443 -s 1234567890abcdef
3228
```
@@ -36,62 +32,27 @@ To download a release of the utility, follow these steps:
3632

3733
- Visit the repository's releases page on GitHub.
3834
- Download the latest release file (typically a JAR file) to your local machine.
39-
- In the same directory as the JAR file, create a `config.properties` file and add this line:
40-
41-
```bash
42-
api.key=<your-netlas-api-key>
43-
```
44-
45-
- Replace `<your-netlas-api-key>` with your actual Netlas API key.
46-
- In a terminal, navigate to the directory containing the JAR and `config.properties` files.
35+
- In a terminal, navigate to the directory containing the JAR file.
4736
- Execute the following command to initiate the utility:
4837
```bash
49-
java -jar c2-search-netlas-<version>.jar -t <ip-or-domain> -p <port>
50-
```
51-
- Replace `<version>` with the version number of the release you downloaded, `<ip-or-domain>` with the IP address or domain you want to search for C2 servers on, and `<port>` with the port you want to scan.
52-
53-
## Docker compose
54-
To build and run the utility using Docker Compose, follow these steps:
55-
- Clone the repository to your local machine:
56-
```bash
57-
git clone https://github.com/michael2to3/c2-search-netlas.git
58-
```
59-
- Navigate to the repository directory:
60-
```bash
61-
cd c2-search-netlas
62-
```
63-
- Create a config.properties file in the root directory of the project and add the following line:
64-
```bash
65-
api.key=<your-netlas-api-key>
66-
```
67-
- Replace `<your-netlas-api-key>` with your actual Netlas API key.
68-
- Open the `.env` file and replace the value of the `API_KEY` environment variable with your actual Netlas API key.
69-
- Run the following command to build and start the Docker containers:
70-
71-
```bash
72-
docker-compose up --build
38+
java -jar c2-search-netlas-<version>.jar -t <ip-or-domain> -p <port> -s <your-netlas-api-key>
7339
```
74-
- Open another terminal and run the following command to search for C2 servers:
75-
```bash
76-
docker-compose exec c2detect c2detect -t <ip-or-domain> -p <port>
77-
```
78-
Replace `<ip-or-domain>` with the IP address or domain you want to search for C2 servers on, and `<port>` with the port you want to scan.
7940

8041
## Docker
8142
To build and start the Docker container for this project, run the following commands:
8243
```bash
83-
docker build -t <image-name> .
84-
docker run -p 8080:8080 <image-name>
44+
docker build -t c2detect .
45+
docker run -it --rm \
46+
c2detect \
47+
-s "your_api_key" \
48+
-t "your_target_domain" \
49+
-p "your_target_port" \
50+
-v
8551
```
86-
Replace `<image-name>` with the name you want to give your Docker image. This will build the Docker image and start the container.
8752

8853
## Source
8954

9055
To use this utility, you need to have a Netlas API key. You can get the key from the Netlas website.
91-
Once you have the API key, create a config.properties file in the root directory of the project and add the following line:
92-
```bash
93-
api.key=<your-netlas-api-key>
94-
```
9556
Now you can build the project and run it using the following commands:
9657
```bash
9758
./gradlew build
@@ -100,7 +61,7 @@ java -jar app/build/libs/c2-search-netlas-1.0-SNAPSHOT.jar --help
10061
This will display the help message with available options.
10162
To search for C2 servers, run the following command:
10263
```bash
103-
java -jar app/build/libs/c2-search-netlas-1.0-SNAPSHOT.jar -t <ip-or-domain> -p <port>
64+
java -jar app/build/libs/c2-search-netlas-1.0-SNAPSHOT.jar -t <ip-or-domain> -p <port> -s <your-netlas-api-key>
10465
```
10566
This will display a list of C2 servers found in the given IP address or domain.
10667

@@ -135,3 +96,5 @@ If you'd like to contribute to this project, please feel free to create a pull r
13596
## License
13697

13798
This project is licensed under the License - see the [LICENSE](https://github.com/michael2to3/c2-search-netlas/blob/main/LICENSE) file for details.
99+
100+

docker-compose.yml

-7
This file was deleted.

0 commit comments

Comments
 (0)