20230320

https://github.com/trustedsec/social-engineer-toolkit/issues/503

error in setoolkit #503

使用setoolkit的时候碰到了**[\*] Looks like the web_server can't bind to 80. Are you running Apache or NGINX?

搜到了上面那个issue

得到的解决方法是

sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill

其中涉及到两个命令 lsof/xargs

lsof

https://www.runoob.com/w3cnote/linux-check-port-usage.html

lsof -i需要root权限 为列出指定进程(符合条件的)

lsof -t -i

另一种查看端口占有情况的命令

netstat

netstat -tunlp 用于显示 tcp,udp 的端口和进程等相关情况。

netstat 查看端口占用语法格式:

netstat -tunlp | grep 端口号
  • -t (tcp) 仅显示tcp相关选项
  • -u (udp)仅显示udp相关选项
  • -n 拒绝显示别名,能显示数字的全部转化为数字
  • -l 仅列出在Listen(监听)的服务状态
  • -p 显示建立相关链接的程序名

例如查看 8000 端口的情况,使用以下命令:

# netstat -tunlp | grep 8000
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      26993/nodejs   

更多命令:

netstat -ntlp   //查看当前所有tcp端口
netstat -ntulp | grep 80   //查看所有80端口使用情况
netstat -ntulp | grep 3306   //查看所有3306端口使用情况

xargs

https://www.runoob.com/linux/linux-comm-xargs.html

xargs(英文全拼: eXtended ARGuments)是给命令传递参数的一个过滤器,也是组合多个命令的一个工具。

xargs 可以将管道或标准输入(stdin)数据转换成命令行参数,也能够从文件的输出中读取数据。

xargs 也可以将单行或多行文本输入转换为其他格式,例如多行变单行,单行变多行。

使用方法是

somecommand |xargs -item  command

使用xargs将前面监听到的pid批量kill

另外被今天被陈巨嘲讽的chmod

chmod

https://www.runoob.com/linux/linux-comm-chmod.html

image

碰到的是chmod 777 filename

意思为给user,group和other对文件的R/W/X权限

在文件权限的描述中,例如drwxr-xr-x

d表示是一个文件夹/l表示为链接/-表示为普通文件

而后面则三位为一组,依次表示了u/g/o对于文件的权限

Shell

最后给shell入个门

https://www.runoob.com/linux/linux-shell-variable.html

noobwei@hecs-414786:~$ mkdir test1
noobwei@hecs-414786:~$ cd test1
noobwei@hecs-414786:~/test1$ touch first.sh
noobwei@hecs-414786:~/test1$ ls
first.sh
noobwei@hecs-414786:~/test1$ chmod 777 first.sh
noobwei@hecs-414786:~/test1$ ./first.sh
Hello World !

其中变量在引用的时候需要加$

其他字符串操作(拼接,获取长度,提取字符串)与其他语言相似

数组的定义方式为array_name=(value0 value1 value2 value3)

而读取数组的方式为${数组名[下标]}

注释方式为#

posted @ 2023-03-20 20:28  noobwei  阅读(38)  评论(0编辑  收藏  举报