issue144:tutoriel3
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue144:tutoriel3 [2019/05/07 08:31] – d52fr | issue144:tutoriel3 [2019/05/08 14:38] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 13: | Ligne 13: | ||
Version: 0.7.1 (2004) | Version: 0.7.1 (2004) | ||
- | Netcat est un utilitaire qui utilise TCP/IP pour lire et écrire des données | + | Netcat est un utilitaire qui utilise TCP/IP pour lire et écrire des données |
Si, pour une raison quelconque, vous ne l'avez pas, installez-le avec : | Si, pour une raison quelconque, vous ne l'avez pas, installez-le avec : | ||
Ligne 19: | Ligne 19: | ||
sudo apt install netcat | sudo apt install netcat | ||
- | Tout administrateur | + | Tout administrateur |
**Looking at the man page for netcat is bleh. Netcat is better understood with examples. Don't go rushing off installing bro pages, netcat is not listed in it yet. The basic syntax for netcat is: | **Looking at the man page for netcat is bleh. Netcat is better understood with examples. Don't go rushing off installing bro pages, netcat is not listed in it yet. The basic syntax for netcat is: | ||
Ligne 29: | Ligne 29: | ||
As stated before, netcat is a utility that does things via TCP/IP; should you require UDP, you have to specify the -u switch. If you are using ports 1-1024, you will require root privileges, anything else is fine as a normal user. You can add netcat to your scripts and it will work just fine. You can also use netcat to scan a range of ports (this is called port scanning), to test if your firewall setup was successful.** | As stated before, netcat is a utility that does things via TCP/IP; should you require UDP, you have to specify the -u switch. If you are using ports 1-1024, you will require root privileges, anything else is fine as a normal user. You can add netcat to your scripts and it will work just fine. You can also use netcat to scan a range of ports (this is called port scanning), to test if your firewall setup was successful.** | ||
- | Un coup d'œil à la page man de netcat est ... bof. Netcat se comprend beaucoup mieux avec des exemeples. Ne vous jetez pas dans l' | + | Un coup d'œil à la page man de netcat est... bof. Netcat se comprend beaucoup mieux avec des exemples. Ne vous jetez pas dans l' |
netcat [options] host port | netcat [options] host port | ||
- | Vous pouvez l' | + | Vous pouvez l' |
- | Comme dit plus haut, netcat est un utilitaire qui agit via TCP/IP ; Si vous avez besoin de UDP, vous devez spécifier le commutateur -u. Si vous utilisez les ports -, vous devrez avoir les provilèges | + | Comme dit plus haut, netcat est un utilitaire qui agit via TCP/IP ; si vous avez besoin de UDP, vous devez spécifier le commutateur -u. Si vous utilisez les ports 1-1024, vous devrez avoir les privilèges |
**IMPORTANT - When scanning addresses on your internet connection, make sure that your ISP allows this, so that you do not get banned from the network. | **IMPORTANT - When scanning addresses on your internet connection, make sure that your ISP allows this, so that you do not get banned from the network. | ||
Ligne 47: | Ligne 47: | ||
w - is just so that the listening times out and does not wait forever.** | w - is just so that the listening times out and does not wait forever.** | ||
- | IMPORTANT - Lors d'un scan d' | + | IMPORTANT - Lors d'un scan d' |
- | Il est aussi très pratique pour vérifier les ports de votre routeur, en prenant ceci en compte : | + | Il est aussi très pratique pour vérifier les ports de votre routeur, en tenant |
- | Ici (présenté ci-dessous) j'ai scanné mon routeur, entre les ports 50 et 60 et j'ai découvert que le port 53 était ouvert. La raison que je connaissais | + | Ici (présenté ci-dessous) j'ai scanné mon routeur, entre les ports 50 et 60 et j'ai découvert que le port 53 était ouvert. La raison que je le savais |
- | v - sortie verbeuse | + | v - sortie verbeuse |
- | n - pas de requète | + | n - pas de requête |
- | z - ne pas envoyer de donner | + | z - ne pas envoyer de données |
w - il est là juste pour qu'il y ait une limite de temps et éviter une attente éternelle. | w - il est là juste pour qu'il y ait une limite de temps et éviter une attente éternelle. | ||
Ligne 71: | Ligne 71: | ||
dd if=/dev/sdc | gzip -c | nc 192.168.8.103 8888** | dd if=/dev/sdc | gzip -c | nc 192.168.8.103 8888** | ||
+ | |||
+ | Comme vous pouvez le voir, l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | Ne vous leurrez pas sur la puissance de netcat. Les pirates peuvent l' | ||
+ | |||
+ | Dans un souci de tout dire, explorons ceci. Sur votre portable, lancez la commande suivante : | ||
+ | |||
+ | nc -lp 8888 | sudo dd of=/ | ||
+ | |||
+ | Puis, sur votre serveur, lancez : | ||
+ | |||
+ | dd if=/dev/sdc | gzip -c | nc 192.168.8.103 8888 | ||
**Now, in this example, my server was at 192.168.0.102, | **Now, in this example, my server was at 192.168.0.102, | ||
Ligne 79: | Ligne 93: | ||
cat / | cat / | ||
+ | |||
+ | Il se trouve que, dans cet exemple, mon serveur est à 192.168.0.102 et mon portable à 192.168.0.103 (en supposant que le port 8888 soit ouvert et parce que les VM (machines virtuelles) accueillies n'ont pas d' | ||
+ | |||
+ | nc -lp 8888 | gunzip -c | sudo dd of=/dev/sdc | ||
+ | |||
+ | et | ||
+ | |||
+ | cat / | ||
**The -lp switch is very handy; it listens on a specific port. In the old days before Teamviewer and the likes, we used the screen command to mirror a screen and chat to one another. Another way of chatting, server to server, or workstation to workstation, | **The -lp switch is very handy; it listens on a specific port. In the old days before Teamviewer and the likes, we used the screen command to mirror a screen and chat to one another. Another way of chatting, server to server, or workstation to workstation, | ||
+ | |||
+ | Le commutateur -lp est très pratique : il écoute sur un port précis. Autrefois, avant Teamviewer et consorts, nous utilisions la commande screen pour avoir une image miroir de l' | ||
**So far we have used netcat with IP addresses, you can also use domain names, which make it handy for testing your websites. The syntax is: | **So far we have used netcat with IP addresses, you can also use domain names, which make it handy for testing your websites. The syntax is: | ||
Ligne 93: | Ligne 117: | ||
while true; do sudo nc -lp 80 < index.html; done** | while true; do sudo nc -lp 80 < index.html; done** | ||
+ | |||
+ | Jusqu' | ||
+ | |||
+ | netcat domain.com port | ||
+ | |||
+ | Si vous avez un domaine vide, et si vous voulez y ranger quelque chose temporairement, | ||
+ | |||
+ | Créons une page d' | ||
+ | |||
+ | nano index.html | ||
+ | |||
+ | while true; do sudo nc -lp 80 < index.html; done | ||
**This keeps serving the page by looping, as if you did not, it would otherwise stop after serving the index page once. | **This keeps serving the page by looping, as if you did not, it would otherwise stop after serving the index page once. | ||
There is lots more netcat can do, and many ways a sharp mind can form this versatile tool. Examples include TCP banner grabber, relays, backdoor shell, etc. Hopefully, you now have an idea of the range of netcat' | There is lots more netcat can do, and many ways a sharp mind can form this versatile tool. Examples include TCP banner grabber, relays, backdoor shell, etc. Hopefully, you now have an idea of the range of netcat' | ||
+ | |||
+ | Ceci rafraîchit la page en boucle, car, si vous ne le faites pas, tout s' | ||
+ | |||
+ | Il y a beaucoup d' | ||
issue144/tutoriel3.1557210680.txt.gz · Dernière modification : 2019/05/07 08:31 de d52fr