Code Monkey home page Code Monkey logo

gmap's Introduction

gmap

A basic project to learn Go which I will be updating through time. The tool is designed to perform port scanning on hosts by leveraging Go's quick run times as well as its portabilities.



Installation

To install gmap, ensure you have Go installed on your machine, then follow these steps:

Clone the repository:

git clone https://github.com/majir96/gmap.git
cd gmap 

Compile using Go

To compile gmap you can use the Go build tool. Here are the steps to do so, including options to reduce the size of the executable:

Build the Executable

go build -ldflags="-s -w" -o gmap .

Options for other OS

You can cross-compile the executable for different operating systems.

Windows
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o gmap.exe main.go

macOS
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o gmap main.go

Reduce the size of the executable

If you have upx installed you can use it to reduce the binary size to make it lighter.

  1. Install upx
sudo apt install upx 

2.Reduce binary size

upx gmap 

Dockerfile

To build and run gmap using Docker:

  1. Build the Docker Image
docker build -t gmap .
  1. Run the Docker Container
docker run --rm -it gmap -t 127.0.0.1 -p 80,443 -o output.txt -f txt

Features

  • Scan specific ports or ranges of ports
  • Scan all ports (0-65535)
  • Perform TCP and UDP scans
  • Export scan results to text, CSV, or JSON files
  • Filter results to show only open ports
  • Set custom timeout for scan operations

Usage

go run main.go -t <IP> -p <PORTS> -s <scan> -o <OUTPUT FILE> -f <FORMAT>

Options

  • -t, --target <IP>: Target to scan (required)
  • -p, --port <PORTS>: Port(s) to scan. Default set to common ports. Separate multiple ports with commas (e.g., -p 22,80,443) or specify a range (e.g., -p 0-100).
  • -p-: Scan all ports (0-65535)
  • -s, --scan <SCAN>: Type of scan to perform. Options:
    • tcp: Perform a TCP scan (default)
    • udp: Perform a UDP scan
  • -h, --help: Display the help message
  • -o, --output <FILE>: Export output to a file (default format: .txt)
  • -f, --format <FORMAT>: Format to export the file to. Formats:
    • txt: Export to text file (default)
    • csv: Export to CSV file
    • json: Export to JSON file
  • --open: Filter by open ports on output
  • --timeout <TIMEOUT>: Timeout for packets when scanning (e.g., 500ms, 2s, 1m)

Examples

Scan a single IP for common ports

go run main.go -t 127.0.0.1

Scan a range of ports on a target IP

go run main.go -t 192.168.1.1 -p 20-80

Perform a UDP scan and export the results to a JSON file

go run main.go -t 10.0.0.1 -p 53,123,161 -s udp -o scan_results -f json
 

Future Implementations

  • Use of Docker to deploy the tool
  • Including nmap support
  • Including new types of scan
  • Including verbose mode
  • Including proxy/IP spoofing
  • Including vulnerability scanning

Contributing

Contributions are welcome! Please fork the repository and create a pull request to add features, improve documentation, or fix bugs.

License

This project is licensed under the GPL License. See the LICENSE file for details.

Ethical Considerations and Responsability

Using gmap to scan networks without proper authorization is illegal and unethical. Always obtain explicit permission from the owner of the network before performing any scans. Unauthorized scanning can lead to severe legal consequences and negatively impact the security and stability of networks. The developers of gmap are not responsible for any misuse of this tool. Use it responsibly and ethically.

gmap's People

Contributors

majir96 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.