2022/05/26

因為要用linux shell 產生值再透過snmp server 讓 librenms 撈出後能畫圖

找到 python snmp server

只要一行指令

Standalone usage: snmp-server.py [-h] [-p PORT] [-c CONFIG] [-d] [-v]

SNMP server

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  port (by default 161 - requires root privileges)
  -c CONFIG, --config CONFIG
                        OIDs config file
  -d, --debug           run in debug mode
  -v, --version         show program's version number and exit

要產生snmp值的範例檔如下

DATA = {
  '1.3.6.1.4.1.1.1.0': integer(12345),
  '1.3.6.1.4.1.1.2.0': bit_string('\x12\x34\x56\x78'),
  '1.3.6.1.4.1.1.3.0': octet_string('test'),
  '1.3.6.1.4.1.1.4.0': null(),
  '1.3.6.1.4.1.1.5.0': object_identifier('1.3.6.7.8.9'),
  # notice the wildcards:
  '1.3.6.1.4.1.1.6.*': lambda oid: octet_string('* {}'.format(oid)),
  '1.3.6.1.4.1.1.?.0': lambda oid: octet_string('? {}'.format(oid)),
  '1.3.6.1.4.1.2.1.0': real(1.2345),
  '1.3.6.1.4.1.3.1.0': double(12345.2345),


snmpwalk 指定 ip port

snmpwalk -c public -v 2c 10.1.1.1:1611 .1.2.3


 

2022/05/21

之前一直都是在synology上使用docker
但因為某個原因
必須在有adsl線路上的几器上能讓外部連入
所以想到在該几器上安裝docker
記錄一下 目前有使用到的指令

安裝
sudo apt install docker.io

檢查狀態
systemctl status docker

設定開几啟動
sudo systemctl enable docker

把要使用docker的user加入docker群組
sudo usermod -aG docker username

登出再登入

檢查docker
docker version

搜尋docker 映像檔 ubuntu
docker search ubuntu

下載映像檔
docker pull ubuntu

列出目前已下載的映像檔
docker images

啟動 container 
docker run -itd container_id /bin/bash

列出目前已啟動的container
docker ps

登入已啟動的container
docker exec -it  container_id /bin/bash

安裝 ssh server
apt install open-sshserver

參考此篇設定使用public key 登入並改變啟動port
假設改為 port 2222

全部改好後存檔成另一個images 
docker commit container_id
會存成另一個images

關閉container
docker stop container_id

重新啟動並對應port 而且啟動ssh server 並設定重開後啟動container
docker run container_id -p 2222:2222 --restart=always /usr/sbin/sshd -D 

docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
<none>       <none>    57d619e840f1   16 hours ago   274MB
ubuntu       latest    d2e4e1f51132   3 weeks ago    77.8MB

刪除不使用的images
docker rmi image_id


查看目前所有容器的狀態 包含正在執行及已stop 
docker ps -a

停止容器的命令如下
$ docker stop container_id

啟動停止的容器 容器內之前的異動資料不會消失
$ docker start container_id


删除容器
$ docker rm container_id




2022/05/17

如何使用 postman 登入 juice shop 並拿到 bearer token


用 POST 而且在 body 以 json 格式輸入 登入的 email及密碼











auth type 選擇 No Auth










Send 後 畫面下方即可得到 bearer token
 











2022/05/13

由於 proxmox 几器愈來愈多

所以使用dsh 來處理升級問題

其他几器暫不考慮

因為還要使用key認証 而且os也有不同

流程如下


先建立群組檔

vi ~/.dsh/group/temp

10.0.0.1

10.0.0.2

10.0.0.3


建立好後指令如下

dsh -g temp -M  -r ssh -- df -h

如果要下多個指令 要使用單引號 而且指令用 ; 隔開

dsh -g temp -M  -r ssh -- 'df-h;ls;date'


https://blog.csdn.net/dcj3sjt126com/article/details/84691641

owasp 提供的靶場


https://owasp.org/www-project-juice-shop/


https://owasp.org/www-project-webgoat/


https://github.com/adeyosemanputra/pygoat


https://github.com/OWASP/SecurityShepherd

2022/05/11

http://www.jsfuck.com/


http://www.atoolbox.net/Tool.php?Id=703


https://utf-8.jp/public/jjencode.html


https://github.com/pablojorge/brainfuck

2022/05/09

今天要disable ubuntu 18.04 的ipv6的時候


在 /etc/sysctl.conf 加入以下三行


net.ipv6.conf.all.disable_ipv6=1

net.ipv6.conf.default.disable_ipv6=1

net.ipv6.conf.lo.disable_ipv6 = 1


sysctl -p 是有作用的 可是重開就不行了

有人說是bug

只好換一種方法

修改 /etc/default/grub

GRUB_CMDLINE_LINUX="ipv6.disable=1"

再update grub

sudo update-grub


重開就ok了


https://linuxconfig.org/how-to-disable-ipv6-address-on-ubuntu-18-04-bionic-beaver-linux