如何利用curl进行hacking

admin 2023年1月29日11:48:01评论64 views字数 2290阅读7分38秒阅读模式

如何利用curl进行hacking

声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由用户承担全部法律及连带责任,文章作者不承担任何法律及连带责任。

前言

主要记录一下curl相关的一些知识

curl,或称客户端URL是一个命令行工具,可以通过终端在设备和服务器之间进行数据交换。

curl最大的特点是它几乎支持所有的主要协议,即:DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET, 和 TFTP。

检查curl的第一件事是,你能用它做什么。点击一个简单的命令:

⇒  curl -h
Usage: curl [options...] <url>
 -d, --data <data>   HTTP POST data
 -f, --fail          Fail silently (no output at all) on HTTP errors
 -h, --help <category>  Get help for commands
 -i, --include       Include protocol response headers in the output
 -o, --output <file>  Write to file instead of stdout
 -O, --remote-name   Write output to a file named as the remote file
 -s, --silent        Silent mode
 -T, --upload-file <file>  Transfer local FILE to destination
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>  Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit

This is not the full help, this menu is stripped into categories.
Use "--help category" to get an overview of all categories.
For all options use the manual or "--help all".

向远程服务器提交一个文件,如果你想用curl来做,有一个命令:

curl -F file=@“file.exe" http://example.com/file/upload/

这将把你的文件上传到所需的服务器上,然后你可以尝试RCE等。

使用curl的另一个很好的例子是我们可以修改默认的DNS配置:

$ curl --dns-ipv4-addr 192.168.0.1 http://www.example.com
$ curl --dns-interface eth1 http://www.example.com

解析主机名的DNS请求将从192.168.0.1或eth1发出。

你也可以用curl来刷新/刷新一个登录表格:-

$ curl --data "[email protected]&password=test" http://1.1.1.1/login.php

我们也可以尝试通过curl创建新用户:-

$ curl --data "name=test&[email protected]&password=test" http://10.10.10.10/newuser.php

捕获HTTP请求的完整跟踪:-

$ curl --trace - https://example.com/

我们也可以用它来从服务器上下载一个文件。

curl –O https://example.com/file.exe

识别服务器上允许的HTTP标头:-

curl –v –X OPTIONS http://www.google.com

curl也被用于HTTP认证中。认证是用来告知服务器用户的用户名和密码,这样它就可以验证你是否被允许发送你所发送的请求。我们可以用这个命令来检查:-

curl —data “uname=test&pass=test” http://example.com/login.php

我们可以为一个请求指定一个referer:-

$ curl --referer http://www.domain.com/login.php http://www.domain.com/admin

它还可以生成个性化的输出。

$ curl --silent --write-out "Response code: %{http_code}nTotal time: %{time_total}" https://example.com

往期回顾

2022年度精选文章

参考

https://www.javatpoint.com/linux-curl-command

原文始发于微信公众号(迪哥讲事):如何利用curl进行hacking

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年1月29日11:48:01
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   如何利用curl进行hackinghttp://cn-sec.com/archives/1527621.html

发表评论

匿名网友 填写信息