Download pdf - Ilugc curl

Transcript
Page 1: Ilugc curl

cURL

Akilan RAkilan [email protected]

Page 2: Ilugc curl

Sat, 13 Nov, 2010 2

cURL?

– http://curl.haxx.se/

Page 3: Ilugc curl

Sat, 13 Nov, 2010 3

cURL?

curl - transfer a URL

– http://curl.haxx.se/

Page 4: Ilugc curl

Sat, 13 Nov, 2010 4

cURL :

– http://curl.haxx.se/

Page 5: Ilugc curl

Sat, 13 Nov, 2010 5

● User + password Authentication

– Basic

– Digest

– NTLM

– Negotiate

– Kerberos● Proxy

● Resume● Cookies● Proxy tunneling● SSL certs● HTTP range requests● UA spoofing● Wireshark● gzip/deflate

cURL

Page 6: Ilugc curl

Sat, 13 Nov, 2010 6

The real cURL

Page 7: Ilugc curl

Sat, 13 Nov, 2010 7

● HTTP● HTTPS● FTP● FTPS● SCP● SFTP● TFTP

● TELNET● LDAP● DICT● POP● SMTP● RTMP● RTSP

The real cURL

Page 8: Ilugc curl

Sat, 13 Nov, 2010 8

What it isn't

Page 9: Ilugc curl

Sat, 13 Nov, 2010 9

What it isn't

Page 10: Ilugc curl

Sat, 13 Nov, 2010 10

But you can build one.. .

Page 11: Ilugc curl

Sat, 13 Nov, 2010 11

Get a fi le

$ curl protocol://example.com/path/to/file

$ curl ftps://example.com/path/to/file

$ curl blah://user:[email protected]:port/file

$ curl -u user:pass scp://example.com/~/personal.txt

Page 12: Ilugc curl

Sat, 13 Nov, 2010 12

more.. .

$ curl -u user:pass -x proxy:3128 \ http://example.com/file

$ curl -u user:pass -x proxy:3128 -u user:pass \ http://example.com/file

Page 13: Ilugc curl

Sat, 13 Nov, 2010 13

Upload

$ curl -T filename http://www.upload.com/myfile

$ curl -T – ftp://ftp.upload.com//myfile

Page 14: Ilugc curl

Sat, 13 Nov, 2010 14

Trace$ curl --trace tracefile http://www.example.com/

$ curl --trace-ascii tracefile http://www.example.com/

Page 15: Ilugc curl

Sat, 13 Nov, 2010 15

Few cool features. . .

$ curl -e www.coolsite.com http://www.showme.com/

$ curl -A 'Konqueror/1.0' http://www.example.com/

$ curl --limit-rate 10K www.far-away-site.com

Page 16: Ilugc curl

Sat, 13 Nov, 2010 16

Few cool features. . .

$ curl -H "X-some-header: yes" www.example.com

$ curl --interface eth0:1 http://www.netscape.com

$ curl -E /path/to/cert.pem:password \https://secure.site.com

$curl telnet://remote.server.com

Page 17: Ilugc curl

Sat, 13 Nov, 2010 17

FTP

$ curl -T – ftp://ftp.upload.com//myfile

$ curl --ftp-port <address> ftp://ftp.upload.com/myfile

$ curl -O ftp://download.com/coolfile -Q '-DELE coolfile'

Page 18: Ilugc curl

Sat, 13 Nov, 2010 18

SMTP

$ curl --mail-rcpt <address> \--mail-from <[email protected]> -u akilan27:pass \--ssl smtp://smtp.gmail.com

Page 19: Ilugc curl

Sat, 13 Nov, 2010 19

HTTP

$ curl “ google.com/search?q=ilugc”

Get requests are simple:

Page 20: Ilugc curl

Sat, 13 Nov, 2010 20

HTTP

$ curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" “ google.com/search?q=ilugc”

Get requests are simple:

Page 21: Ilugc curl

Sat, 13 Nov, 2010 21

HTTP

$ curl --user-agent "Mozilla/5.0 [en] (X11; U; Linux 2.6.28 i386)" “ http://google.com/search?q=ilugc”

Get requests are simple:

Post requests are also simple with curl. ;-)

$ curl --data-urlencode input=value http://example.com/cgi

Page 22: Ilugc curl

Sat, 13 Nov, 2010 22

HTTP

$ curl --proxy-user proxyuser:proxypassword curl.haxx.se

Proxy

Post requests are also simple with curl. ;-)

$ curl --data-urlencode input=value http://example.com/cgi

Page 23: Ilugc curl

Sat, 13 Nov, 2010 23

Scripting cURL

curl http://username:[email protected]/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG

Update your dyndns:

Page 24: Ilugc curl

Sat, 13 Nov, 2010 24

Scripting cURL

curl -c mycookie --data-urlencode [email protected] --data-urlencode pwd=password http://example.com/ValidateEntry.php

Login to a website and perform requests

Page 25: Ilugc curl

Sat, 13 Nov, 2010 25

Scripting cURL

curl -c cookie --data-urlencode [email protected] \ --data-urlencode pwd=password \ http://example.com/ValidateEntry.php

curl -b cookie --data-urlencode uid=bar – data-urlencode \ action=del http://example.com/usermanip.php

Login to a website and perform requests

Page 26: Ilugc curl

Sat, 13 Nov, 2010 26

Scripting cURL

curl -c cookie --data-urlencode [email protected] \ --data-urlencode pwd=password \ http://example.com/ValidateEntry.php

curl -b cookie --data-urlencode uid=bar – data-urlencode \ action=del http://example.com/usermanip.php

rm cookie

Login to a website and perform requests