1597, 1/80 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ÇØÅ·ÀßÇÏ°í½Í´Ù
   http://¾øÀ½
   python.png (147.9 KB), Download : 4464     [¿À¸¥ÂÊ ¹öÆ° ´­·¯ ´Ù¿î ¹Þ±â]
   image_(1).png (99.8 KB), Download : 6347     [¿À¸¥ÂÊ ¹öÆ° ´­·¯ ´Ù¿î ¹Þ±â]
   ÆÄÀ̽ã äÆà ÇÁ·Î±×·¥ ±¸Çö

http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=8579 [º¹»ç]




Ŭ¶óÀ̾ðÆ® ±¸Çö

¼­¹ö¿¡ µ¥ÀÌÅ͸¦ ÁÖ°í ¹Þ±â À§ÇØ ¼ÒÄÏ ¿¬°á ¿äûÀ» ÇÏ´Â ÃøÀ¸·Î
IP¿Í Æ÷Æ®¹øÈ£·Î ¼­¹ö¿¡ ¿¬°áÀ» ¿äûÇÑ´Ù.


ÄÚµå ¿¹Á¦¸¦ º¸±â ÀÌÀü¿¡ setsockopt ¸Þ¼Òµå¿¡ ´ëÇØ ¾Ë¾Æº¸°Ú´Ù.



---------------------------------------------------------------
socket.setsockopt(level, optname, None, optlen: int)

Set the value of the given socket option (see the Unix manual page setsockopt(2)).
The needed symbolic constants are defined in this module
(SO_* etc. <socket-unix-constants>).
The value can be an integer,
None or a bytes-like object representing a buffer.
In the later case it is up to the caller to ensure
that the bytestring contains the proper bits
(see the optional built-in module struct for a way to encode C structures as bytestrings).
When value is set to None, optlen argument is required.
It¡¯s equivalent to call setsockopt() C function with optval=NULL and optlen=optlen.


Çؼ®

ÁÖ¾îÁø ¼ÒÄÏ ¿É¼ÇÀÇ °ªÀ» ¼³Á¤ÇÕ´Ï´Ù. ÇÊ¿äÇÑ »ó¼ö´Â ÀÌ ¸ðµâ¿¡¼­ Á¤Àǵ˴ϴÙ
SO_* µî, <socket-unix-constants>¸¦ ÂüÁ¶Çϼ¼¿ä).
°ªÀº Á¤¼ö, None ¶Ç´Â ¹öÆÛ¸¦ ³ªÅ¸³»´Â ¹ÙÀÌÆ®·ù °´Ã¼ÀÏ ¼ö ÀÖ½À´Ï´Ù.
ÈÄÀÚÀÇ °æ¿ì È£ÃâÀÚ°¡ ¿Ã¹Ù¸¥ ºñÆ®¸¦ Æ÷ÇÔÇÏ´ÂÁö È®ÀÎÇØ¾ß ÇÕ´Ï´Ù
(¿É¼ÇÀ¸·Î ³»Àå ¸ðµâ struct¸¦ »ç¿ëÇÏ¿© C ±¸Á¶Ã¼¸¦ ¹ÙÀÌÆ®¿­·Î ÀÎÄÚµùÇÏ´Â ¹æ¹ýÀ» ÂüÁ¶Çϼ¼¿ä).
°ªÀÌ NoneÀ¸·Î ¼³Á¤µÈ °æ¿ì optlen Àμö°¡ ÇÊ¿äÇÕ´Ï´Ù.
ÀÌ°ÍÀº optval=NULL ¹× optlen=optlenÀ¸·Î setsockopt() C ÇÔ¼ö¸¦ È£ÃâÇÏ´Â °Í°ú µ¿µîÇÕ´Ï´Ù.
-----------------------------------------------------------------
ÀÚ¼¼ÇÑ °Ç ¾Æ·¡ÀÇ ¸µÅ©·Î...
https://docs.python.org/ko/3.10/library/socket.html









Ŭ¶óÀ̾ðÆ® Ãø ¼Ò½º

import socket

server_host = 127.0.0.1 # Loopback IP
server_port = 44444

client_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

#connect to server
client_sock.connect((server_host, server_port))
print(f'Server: {server_host}, {server_port} connect nomally')

while True:
    message = input(">>> ")
    client_sock.sendall(message.encode('utf-8'))
    message = client_sock.recv(1024)
    print(f"server: {message.decode()}")
client_sock.close()



¼­¹ö ±¸Çö & ¼­¹ö Ãø ¼Ò½º

import socket

host = '127.0.0.1'
port = 44444

parent_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
parent_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

parent_sock.bind((host, port))
parent_sock.listen(5)
print(f'Server IP: {host}, Port Num: {port} excuting to server...')

child_sock, child_addr = parent_sock.accept()
print(f'accept from {child_addr}')

while True:
    message = child_sock.recv(1024)
    print(f'{child_addr}: {message.decode()}')
    child_sock.sendall(message)

child_sock.close()
parent_sock.close()

  Hit : 871     Date : 2024/05/28 11:45



    
     [°øÁö] °­Á¸¦ ¿Ã¸®½Ç ¶§´Â ¸»¸Ó¸®¸¦ ´Þ¾ÆÁÖ¼¼¿ä^¤Ñ^ [29] ¸Û¸Û 02/27 19477
1596   [pwnable.kr] bof     ÇØÅ·ÀßÇÏ°í½Í´Ù
12/25 8
1595   [pwnable.kr] Shellshock[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 126
1594   ShellshockÀÇ ±âº» ¿ä¾à     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 108
1593   [pwnable.kr] fd     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 102
1592   VPNÀÌ ¿¬°áµÇ¾ú´Ù°¡ µµÁß¿¡ ²¨µµ À¥ ºê¶ó¿ìÀú»ó¿¡¼­ À¯ÁöµÇ´Â ÀÌÀ¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 108
1591   ÇØÄ¿µéÀÌ ÇØÅ·½Ã »ç¿ëÇÏ´Â µð·ºÅ丮 °ø°£[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 148
1590   Keyboard Hooking -part2 - (Python3 ver)     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 125
1589   [Windows API] Keyboard Hooking     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 102
1588   [pwnable.kr] cmd1 °ø·«     ÇØÅ·ÀßÇÏ°í½Í´Ù
10/23 263
1587   netdiscover ÆÄÀ̽ãÀ¸·Î ±¸ÇöÇϱ⠠   ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 541
1586   ÆÄÀ̽ãÀ» ÀÌ¿ëÇÑ ½ÉÇà À¥ Å©·Ñ·¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 429
1585   ÆÄÀ̽ã random¸ðµâÀ» ÀÌ¿ëÇÑ ¼ýÀÚ¸ÂÃ߱⠰ÔÀÓ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/30 983
  ÆÄÀ̽ã äÆà ÇÁ·Î±×·¥ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/28 870
1583   ÆÄÀ̽㠼ÒÄÏ ÇÁ·Î±×·¡¹ÖÀÇ ±âÃÊ     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/26 1025
1582   ¸®´ª½º À¥ ·Î±× ºÐ¼®     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/20 687
1581   ¸®´ª½º/À©µµ¿ì º¸¾È Àåºñ ·Î±×     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/20 835
1580   °í¼ö´ÔµéÀÇ µµ¿òÀ» ¹Þ°í ½Í½À´Ï´Ù     vbnm111
02/11 927
1579   ¸®´ª½º Ä¿³Î 2.6 ¹öÀü ÀÌÈÄÀÇ LKM     jdo
07/25 1440
1578   ½©ÄÚµå ¸ðÀ½     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/15 2323
1 [2][3][4][5][6][7][8][9][10]..[80]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org