1602, 1/81 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ÇØÅ·ÀßÇÏ°í½Í´Ù
   http://¾øÀ½
   random.png (231.9 KB), Download : 17     [¿À¸¥ÂÊ ¹öÆ° ´­·¯ ´Ù¿î ¹Þ±â]
   ÆÄÀ̽ã random¸ðµâÀ» ÀÌ¿ëÇÑ ¼ýÀÚ¸ÂÃ߱⠰ÔÀÓ ±¸Çö

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



ÁïÈïÀûÀ¸·Î ÆÄÀ̽㠼ýÀÚ¸ÂÃ߱⠰ÔÀÓÀ» ±¸ÇöÇغôÙ.
ÀÌ °­Á¿¡¼­´Â ¾Æ·¡ÀÇ Ã¤Æà ÇÁ·Î±×·¥ ¸¸µé±â ¼Ò½º¸¦ ¾à°¾ º¯ÇüÇÏ°í
Ãß°¡Çؼ­ ÇÁ·Î±×·¥À» ¿Ï¼º½ÃÄ×´Ù. (»ç½Ç º°°Å ¾Æ´Ï´Ù...)

¼Ò½º Äڵ带 ÷ºÎÇÏ°Ú´Ù.




=====server.py=====
import random
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}')

rand_ans = random.randint(1, 100) # 'Generate a random number between 1 and 100
while True:
    answer = int(child_sock.recv(4))
    if answer > rand_ans:
        child_sock.send("The input value is greater than the correct answer".encode('utf-8'))

    elif answer < rand_ans:
        child_sock.send("The input value is less than the correct answer".encode('utf-8'))
  
    else:
        child_sock.send("Right, You finally got it!".encode('utf-8'))
        break
child_sock.close()
parent_sock.close()
==========







=====client.py=====
import socket

server_host = '127.0.0.1' # Loopback address
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 nomarlly')

count = 1

while True:
    message = input("please enter integer between 1 to 100>>> ")
    client_sock.sendall(message.encode('utf-8'))
    message = client_sock.recv(256)
    print(f"server : {message.decode()}")
    if message == "Right, You finally got it!".encode('utf-8'):
        break
    count = count + 1

print("count : ", count)
client_sock.close()
===========




Almost all module functions depend on the basic function random(), which generates a random float uniformly in the half-open range 0.0 <= X < 1.0. Python uses the Mersenne Twister as the core generator. It produces 53-bit precision floats and has a period of 2**19937-1. The underlying implementation in C is both fast and threadsafe. The Mersenne Twister is one of the most extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for all purposes, and is completely unsuitable for cryptographic purposes.

Çؼ®

°ÅÀÇ ¸ðµç ¸ðµâ ÇÔ¼ö´Â ±âº» ÇÔ¼ö random()¿¡ ÀÇÁ¸ÇÑ´Ù.
ÀÌ ÇÔ¼ö´Â ¹ÝÀ¸·Î ¿­¸° ¹üÀ§¿¡¼­ ±ÕÀÏÇÏ°Ô ·£´ýÇÑ ºÎµ¿ ¼Ò¼öÁ¡À» »ý¼ºÇÑ´Ù.
Áï, 0.0 ÀÌ»óÀÌ°í 1.0 ¹Ì¸¸ÀÌ´Ù.
ÆÄÀ̽ãÀº Mersenne Twister¸¦ ÇÙ½É »ý¼º±â·Î »ç¿ëÇÑ´Ù.
ÀÌ´Â 53ºñÆ® Á¤¹ÐµµÀÇ ºÎµ¿ ¼Ò¼öÁ¡À» »ý¼ºÇϸç 2**19937-1ÀÇ Áֱ⸦ °¡Áö°í ÀÖ´Ù.
C·Î ±¸ÇöµÈ ÇϺΠ±¸ÇöÀº ºü¸£°í ½º·¹µå ¾ÈÀüÇÏ´Ù.
Mersenne Twister´Â Á¸ÀçÇÏ´Â °¡Àå öÀúÇÏ°Ô Å×½ºÆ®µÈ ³­¼ö »ý¼º±â Áß Çϳª´Ù.
±×·¯³ª ¿ÏÀüÈ÷ °áÁ¤·ÐÀûÀ̱⠶§¹®¿¡ ¸ðµç ¿ëµµ¿¡ ÀûÇÕÇÏÁö ¾ÊÀ¸¸ç,
¾Ïȣȭ ¿ëµµ·Î´Â ÀüÇô ÀûÇÕÇÏÁö ¾Ê´Ù.










ÆÄÀ̽ãÀÇ ·£´ý ¸ðµâÀ» ÀÌ¿ëÇÏ¿© ¼ýÀÚ ¸ÂÃ߱⠰ÔÀÓÀ» ¸¸µé¾ú´Ù.
rand_ans = random.randint(1, 100) # 'Generate a random number between 1 and 100
1ÀÌ»ó 100ÀÌÇÏÀÇ ¼ýÀÚ¸¦ ¹«ÀÛÀ§·Î »ý¼ºÇؼ­ rand_ans º¯¼ö¿¡ ÀúÀåÇÑ´Ù.
·£´ýÀ¸·Î ¹Þ´Â ³­¼ö »©°ï º°°Å ¾ø´Â °Å¶ó¼­ ´õ ÀÌ»óÀÇ ¼³¸íÀÌ ÇÊ¿ä¾øÀ» µí ÇÏ´Ù.

  Hit : 1157     Date : 2024/05/30 12:36



    
     [°øÁö] °­Á¸¦ ¿Ã¸®½Ç ¶§´Â ¸»¸Ó¸®¸¦ ´Þ¾ÆÁÖ¼¼¿ä^¤Ñ^ [29] ¸Û¸Û 02/27 19621
1601   ½Ã½ºÅÛ ÄÝ ÃßÀû È®ÀåÆÇ[2]     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/19 160
1600   °£´ÜÇÑ ½Ã½ºÅÛ ÄÝ ÃßÀû ÇÁ·Î±×·¥ ¸¸µé±â     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/18 147
1599   [overthewire.org] - leviathan1     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/14 423
1598   [overthewire.org] - leviathan0     ÇØÅ·ÀßÇÏ°í½Í´Ù
01/14 172
1597   [Write Up] Crypto Cat's CTF 2024 - BabyFlow     ÇØÅ·ÀßÇÏ°í½Í´Ù
12/29 224
1596   [pwnable.kr] bof     ÇØÅ·ÀßÇÏ°í½Í´Ù
12/25 202
1595   [pwnable.kr] Shellshock[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 356
1594   ShellshockÀÇ ±âº» ¿ä¾à     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 331
1593   [pwnable.kr] fd     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/23 326
1592   VPNÀÌ ¿¬°áµÇ¾ú´Ù°¡ µµÁß¿¡ ²¨µµ À¥ ºê¶ó¿ìÀú»ó¿¡¼­ À¯ÁöµÇ´Â ÀÌÀ¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 307
1591   ÇØÄ¿µéÀÌ ÇØÅ·½Ã »ç¿ëÇÏ´Â µð·ºÅ丮 °ø°£[1]     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/22 386
1590   Keyboard Hooking -part2 - (Python3 ver)     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 366
1589   [Windows API] Keyboard Hooking     ÇØÅ·ÀßÇÏ°í½Í´Ù
11/20 310
1588   [pwnable.kr] cmd1 °ø·«     ÇØÅ·ÀßÇÏ°í½Í´Ù
10/23 478
1587   netdiscover ÆÄÀ̽ãÀ¸·Î ±¸ÇöÇϱ⠠   ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 727
1586   ÆÄÀ̽ãÀ» ÀÌ¿ëÇÑ ½ÉÇà À¥ Å©·Ñ·¯     ÇØÅ·ÀßÇÏ°í½Í´Ù
08/13 592
  ÆÄÀ̽ã random¸ðµâÀ» ÀÌ¿ëÇÑ ¼ýÀÚ¸ÂÃ߱⠰ÔÀÓ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/30 1156
1584   ÆÄÀ̽ã äÆà ÇÁ·Î±×·¥ ±¸Çö     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/28 1072
1583   ÆÄÀ̽㠼ÒÄÏ ÇÁ·Î±×·¡¹ÖÀÇ ±âÃÊ     ÇØÅ·ÀßÇÏ°í½Í´Ù
05/26 1272
1 [2][3][4][5][6][7][8][9][10]..[81]

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