_Author_ = Peanuts
最近是要打第二次awd,总结一下免得自己到时候手忙脚乱?
连接篇
正常ssh利用密钥登陆:
ssh -i -id_ras user@ip
免密登陆命令:
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.100
将公钥复制,实现免密登陆,root处换成需要的。
文件的上传复制
sftp:
免密登陆后: sftp 用户名@ip 正常的:cd // ls等命令 获取:get 文件名 下载 put 文件名 上传
scp:
本地文件下载: scp -i ~/id_rsa 文件名 用户名@ip :远程路径 scp 文件名 用户名@计算机ip:远程路径(下载到本地)
ps文件上传完后要注意运行的权限必要的时候 chmod +x 文件名
脚本篇
自动get脚本
def exploit(host,port):
try:
flag = get_flag(host,port)
submit(flag,token)
except Exception as m:
print(m)
def exploit_it():
with open("ip_file")as f :
for line in f:
host = line.split(":")[0]
port = int(line.split(":")[1])
print "[+] Exploiting:%s:%d" % (host,port)
exploit(host,port)
自动提交脚本(要安装reques库)
def submit(flag, token):
url = "wangzhi"
pos = {
"flag":flag
"token":token
}
print "[+] Submiting flag : [%s]" % (pos)
response = requests.post(url,data=data)
content = response.content
print "[+] Content : %s " % (content)
if failed in content:
print "[-]failed"
return False
else:
print "[+] Success!"
return True