Giter Club home page Giter Club logo

socketcat's Introduction

SocketCat

A few simple tools for connecting to sockets and sending and recving with them. Currently written for AF_UNIX and AF_INET

socket-cat {cat,echo,send,write} {bind,connect} {unix,inet} <socket-address>

See socket-cat --help for full argparse help

$ socket-cat {...} bind {...} <socket-address> binds to the specified address and runs a socketserver

$ socket-cat {...} connect {...} <socket-address> connects to the specified address as a client

Programs

socket-cat send

Reads from stdin and writes to the socket

socket-cat cat

Reads from the socket and writes to stdout

Inspired by cat(1)

socket-cat write

Reads from stdin and writes to the socket

Reads from the socket and writes to stdout

This is a nice program for talking to a socket, combining both send and cat's abilities

Inspired by write(1)

socket-cat echo

Reads from the socket and writes back to the socket

Inspired by echo(1)

Examples

Talk to HTTPD

Send a simple HTTP/0.9 GET request to Apache running on localhost:80 and get the response

$ echo -ne "GET /\r\n\r\n" | ./src/socket-cat.py write connect inet 127.0.0.1 80
read(): 0 from stdin, calling shutdown(SHUT_WR)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
...
</html>
recv(): 0 from socket; remote end called shutdown(SHUT_WR)

Echo server

Run an echo server as a systemd unit serving at localhost:9001

[Service]
Type=forking
ExecStart=/home/jb2170/Repositories/Python/SocketCat/src/socket-cat.py echo bind --fork inet 127.0.0.1 9001

And talk to it via

$ echo "Hello, World!" | ./src/socket-cat.py write connect inet 127.0.0.1 9001
Hello, World!
recv(): 0 from socket; remote end called shutdown(SHUT_WR)

socketcat's People

Contributors

jb2170 avatar

Watchers

 avatar

socketcat's Issues

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.