Application wirtten in GO to check if the port on the remote host is open

portcheck

A simple Pod that get API POST request with port type and number with a target's IP address and checks if the destination port is available

Getting started

There are a few ways of using the tool , I will try to go over all the posibilities for both connected and disconnected environment.

Connected environment

For a Connected Environment you can use the portcheck tool directly (with a deamonset deployment) or you can use it with spearedge which allows you to set one which host the Pod will be created and run the test from.

Steps

The first step is to clone the git repository :

# git clone https://gitlab.com/two.oes/portcheck.git

And now create the namespce for our pods

# kubectl create ns port-check

Next we can go to Deployment and then we can do one of the 2

Only portcheck

To run portcheck alone all we need to do is to deploy the daemonset , the reason that this is a daemonset is that we want to make sure the test is available from all the nodes (the workers).

To Deploy the daemonset all we need to do is to run :

# kubectl apply -f portcheck/Deployment/portcheck-daemonset.yaml

And then Apply the Service :

# kubectl apply -f portcheck/Deployment/portcheck-svc.yaml

In order for the service to be availble from outside of the cluster we need to create a route/ingress resource :

# kubectl apply -f portcheck/Deployment/portcheck-route.yaml

And That is it !!!
If you want to test it you can use the on of my test scripts :

# export MY_URL="<the route URL>"
# export REMOTE_HOST="<Remote host/FQDN>"
# export DST_PORT="<port number>"
# ./portcheck/test/test_portcheck.sh

I recommand testing it with both an Open port and a closed one to see the different results

Using spearedge

Speardge is a service that listen (as portcheck) to remote port , remote host and protocol but it also expect a hostname for one of the worker of the cluster. The main Idea is to tell it on which node (worker) should the Pod sprone up and then run a test from that node. In case we want to know which nodes are available on the cluster we can run a listnodes request

In order to deploy it first we need to deploy the role , role binding and the service account for spearedge :

For the listnodes option :

# kubectl apply -f portcheck/Deployment/clusterRole-listNodes.yaml
# kubectl apply -f portcheck/Deployment/clusterRoleBinding.yaml
# kubectl apply -f portcheck/Deployment/serviceaccount.yaml

And to allow it to create the portcheck pod :

# kubectl apply -f portcheck/Deployment/role-pods.yaml
# kubectl apply -f portcheck/Deployment/rolePodBinding.yaml

Now we need to deploy the deployment :

# kubectl apply -f portcheck/Deployment/spearedge-deployment.yaml

And the Service

# kubectl apply -f portcheck/Deployment/spearedge-svc.yaml

Same as for the portcheck deployment , we need to expose the service for out of the cluster :

# kubectl apply -f portcheck/Deployment/spearedge-route.yaml

Now you can list the nodes in the cluster :

# curl -s https://$(oc get route spearedge -o jsonpath='{.spec.host}')/listnodes

Select on of the nodes and run the test :

# export MY_URL="https://$(oc get route spearedge -o jsonpath='{.spec.host}')/checkport"
# export REMOTE_HOST="<Remote host>"
# export DST_PORT="<Destination Port>"
# export OCP_HOSTNAME="<one of the cluster workers>"
# ./test/test_spearedge.sh

If you want to use it with a Web interface for delegation you can write it and just run the POST request from A web form

Disconnected environment

For Disconnected environment we can do a few steps.

First save the 2 images:

# podman save registry.gitlab.com/two.oes/portcheck/portcheck -o portcheck.tar
# podman save registry.gitlab.com/two.oes/portcheck/spearedge -o spearedge.tar

Now you can take it (with the git repository) to the disconnected environment

What to change ?

Only Portcheck

For portcheck only just update the image referance in the portcheck-daemonset.yaml file

Using spearedge

In the spearedge deployment you can change the image reference and change the environment variable that points to the portcheck Image which it needs to pull.

Have Fun !!!

Similar Resources

Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com).

Go Modules Remote Import Path Proxy Proxy your Go Module`s Import Path from your own domain to a public host (e.g. github.com). For example Uber (buil

Nov 2, 2021

Ping library for Golang with multi-host support

pingo Fast and lightweight ping library for Golang with multi-host support. Features ICMP sockets: UDP port 0 means "let the kernel pick a free number

Nov 9, 2022

apache dubbo gateway,L7 proxy,virtual host,k8s ingress controller.

apache dubbo gateway,L7 proxy,virtual host,k8s ingress controller.

apache dubbo gateway,L7 proxy,virtual host,k8s ingress controller.

Jul 22, 2022

Simple ssh client for persistent host info.

Simple ssh client for persistent host info.

zssh Simple ssh cli for persistent hosts information. Getting started (1) Go get and install $ go get -u github.com/zacscoding/zssh/... $ zssh --help

Dec 19, 2021

Observe host metrics collector Written in Go

Observe Host Metrics Collector Experimental collector and forwarder of host metr

Jan 4, 2022

Ffind - A tool to find files of interest on a compromised host during a penetration test

Ffind - A tool to find files of interest on a compromised host during a penetration test

ffind ffind is a tool to find files of interest on a compromised host during a p

Jul 25, 2022

C-ping is a very simple and small ping tool that sends ICMP Echo datagram to a host.

C-ping is a very simple and small ping tool that sends ICMP Echo datagram to a host.

Aug 9, 2022

Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Dec 31, 2022

Use ICMP requests to check the alive subnet.

Doge-AliveCheck Use ICMP requests to check the alive subnet. Build go build -ldflags "-s -w" -trimpath Usage Doge-AliveCheck.exe

Nov 11, 2022
Related tags
port close check scanner. detects open ports, sends alert with slack.

aite9 (port close check scanner) サーバのポートが空いてないことを確認するポートスキャナー たくさんのサーバを管理していると設定ミスで内部利用ポートが外部に公開されてしまっている可能性があり、それに早く気付くためのチェックツールです。 サーバのリストを標準入力で渡すと

Feb 3, 2022
EasyAgent is an infrastructure component, applied to manage the life-cycle of services on the remote host.
EasyAgent is an infrastructure component, applied to manage the life-cycle of services on the remote host.

Easyagent English | 中文 介绍 easyagent是在袋鼠云内部广泛使用的基础架构组件,最佳应用场景包括ELK体系beats等数据采集器的管控和配置管理、数栈体系自动化部署等 基本原理 easyagent主要有sidecar和server两个组件,sidecar部署在主机端,si

Nov 24, 2022
The rest api that can manage the iptables rules of the remote host

fiewall-api firewall api是基于firewalld来远程管理iptables规则的rest-api,无需部署agent Features 指定一个主机ip,让这个主机上的iptables增加一个规则 处理单个IP或CIDR范围(xx.xx.xx.xx/mask,mac,inte

Mar 24, 2022
oniongrok forwards ports on the local host to remote Onion addresses as Tor hidden services and vice-versa

oniongrok Onion addresses for anything. oniongrok forwards ports on the local host to remote Onion addresses as Tor hidden services and vice-versa. Wh

Jan 1, 2023
golang script to check server & port status

netcheck Simple script to check if host alive by sending ICMP messages & TCP Port checks. ICMP messages not working without sudo privileges. usage net

Sep 2, 2022
Simple HTTP tunnel using SSH remote port forwarding

Simple HTTP tunnel using SSH remote port forwarding

Nov 18, 2022
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

Nov 10, 2021
LazySSH is an SSH server that acts as a jump host only, and dynamically starts temporary virtual machines.

LazySSH is an SSH server that acts as a jump host only, and dynamically starts temporary virtual machines. If you find yourself briefly starti

Dec 11, 2022
Receive phone calls from anybody on the Web. Or host a telephony server yourself.
Receive phone calls from anybody on the Web. Or host a telephony server yourself.

WebCall WebRTC Telephony Server Browser based telephony over E2E-encrypted P2P-links with very high audio quality. WebCall is lightweight and easy to

Jan 5, 2023
⚡ 🖥️ 👾 Host your own Lightning Address on LND

⚡ ??️ ?? Host your own Lightning Address on LND Lighting Wallets like BlueWallet, Blixt and many more allow us to send sats to Lighting Addresses like

Dec 22, 2022