Skip to content

bhutuklearning/The-Proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

C Proxy Server

Language Platform Version

A lightweight and efficient proxy server implementation in C, supporting both Linux and Windows platforms. This proxy server can handle HTTP/HTTPS requests and includes features like request logging, SSL/TLS support, and configurable port settings.

Project Structure

04_Finalize/
├── Linux/
│   ├── proxy.c          # Main proxy server source code
│   ├── server.crt       # SSL certificate
│   ├── server.key       # SSL private key
│   └── proxy_log.txt    # Log file
└── windows/
    ├── WinProxy.c       # Windows-specific proxy server code
    ├── proxy.exe        # Compiled Windows executable
    └── proxy_log.txt    # Log file

Prerequisites

Linux

  • GCC compiler
  • OpenSSL development libraries
  • Make build system

Windows

  • MinGW-w64 or MSVC compiler
  • OpenSSL development libraries
  • Windows 10 or later

Building and Running

Linux

  1. Navigate to the Linux directory:

    cd Linux
  2. Compile the proxy server:

    gcc -o proxy_server proxy.c -lssl -lcrypto
  3. Run the proxy server:

    ./proxy_server
  4. To run in the background:

    ./proxy_server &
    
    

The server will start on port 8080 by default. You can configure your browser to use this proxy server by setting:

  • Proxy address: 127.0.0.1
  • Port: 8080

For Firefox:

  1. Go to Settings > Network Settings
  2. Select "Manual proxy configuration"
  3. Enter HTTP Proxy: 127.0.0.1
  4. Enter Port: 8080
  5. Click OK

For Chrome:

  1. Go to Settings > Advanced > System
  2. Click "Open your computer's proxy settings"
  3. Enter HTTP Proxy: 127.0.0.1
  4. Enter Port: 8080
  5. Click Save

Windows

  1. Navigate to the windows directory:

    cd windows
  2. You can either:

    • Use the pre-compiled proxy.exe directly
    • Or compile from source using MinGW-w64:
      gcc -o proxy.exe WinProxy.c -lssl -lcrypto
  3. Run the proxy server:

    proxy.exe

The server will start on port 8080 by default. Configure your browser's proxy settings as mentioned above.

Features

  • HTTP/HTTPS proxy support
  • SSL/TLS encryption
  • Request logging
  • Configurable port settings
  • Cross-platform compatibility
  • Error handling and recovery

Logging

Both Linux and Windows versions maintain logs in their respective proxy_log.txt files. The logs include:

  • Connection attempts
  • Request details
  • Error messages
  • SSL/TLS handshake information

Security Notes

  • The included SSL certificates are for development purposes only
  • For production use, replace server.crt and server.key with your own certificates
  • Always use HTTPS for sensitive data transmission

Troubleshooting

  1. If the server fails to start:

    • Check if port 8080 is already in use
    • Verify SSL certificate permissions
    • Ensure all required libraries are installed
  2. If connections fail:

    • Verify proxy settings in your browser
    • Check firewall settings
    • Review the log file for error messages

License

This project is open source and available under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

The Proxy server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages