SWLUG 163

[C] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์Šค์ฟจ_1์ฃผ์ฐจ ๊ณผ์ œ ๋ฌธ์ œ: ๊ณต๋ฐฐ์ˆ˜

[1] ๋ฌธ์ œ ๋ฌธ์ œ ์„ค๋ช… ์ •์ˆ˜ number์™€ n, m์ด ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. number๊ฐ€ n์˜ ๋ฐฐ์ˆ˜์ด๋ฉด์„œ m์˜ ๋ฐฐ์ˆ˜์ด๋ฉด 1์„ ์•„๋‹ˆ๋ผ๋ฉด 0์„ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”. ์ œํ•œ์‚ฌํ•ญ 10 ≤ number ≤ 100 2 ≤ n, m < 10 ์ž…์ถœ๋ ฅ ์˜ˆ number n m result 60 2 3 1 55 10 5 0 ์ž…์ถœ๋ ฅ ์˜ˆ ์„ค๋ช… ์ž…์ถœ๋ ฅ ์˜ˆ #1 60์€ 2์˜ ๋ฐฐ์ˆ˜์ด๋ฉด์„œ 3์˜ ๋ฐฐ์ˆ˜์ด๊ธฐ ๋•Œ๋ฌธ์— 1์„ returnํ•ฉ๋‹ˆ๋‹ค. ์ž…์ถœ๋ ฅ ์˜ˆ #2 55๋Š” 5์˜ ๋ฐฐ์ˆ˜์ด์ง€๋งŒ 10์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— 0์„ returnํ•ฉ๋‹ˆ๋‹ค. [2] ์ •๋‹ต & ํ•ด์„ (1) ์˜ค๋‹ต #include #include #include int solution(int number, int n, int m) { int answer = 0; if..

[C] ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์Šค์ฟจ_1์ฃผ์ฐจ ๊ณผ์ œ ๋ฌธ์ œ: n์˜ ๋ฐฐ์ˆ˜

[1] ๋ฌธ์ œ ๋ฌธ์ œ ์„ค๋ช… ์ •์ˆ˜ num๊ณผ n์ด ๋งค๊ฐœ ๋ณ€์ˆ˜๋กœ ์ฃผ์–ด์งˆ ๋•Œ, num์ด n์˜ ๋ฐฐ์ˆ˜์ด๋ฉด 1์„ return n์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด 0์„ returnํ•˜๋„๋ก solution ํ•จ์ˆ˜๋ฅผ ์™„์„ฑํ•ด์ฃผ์„ธ์š”. ์ œํ•œ์‚ฌํ•ญ 2 ≤ num ≤ 100 2 ≤ n ≤ 9 ์ž…์ถœ๋ ฅ ์˜ˆ num n result 98 2 1 34 3 0 ์ž…์ถœ๋ ฅ ์˜ˆ ์„ค๋ช… ์ž…์ถœ๋ ฅ ์˜ˆ #1 98์€ 2์˜ ๋ฐฐ์ˆ˜์ด๋ฏ€๋กœ 1์„ returnํ•ฉ๋‹ˆ๋‹ค. ์ž…์ถœ๋ ฅ ์˜ˆ #2 32๋Š” 3์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์•„๋‹ˆ๋ฏ€๋กœ 0์„ returnํ•ฉ๋‹ˆ๋‹ค. [2] ์ •๋‹ต & ํ•ด์„ #include #include #include int solution(int num, int n) { int answer = 0; if (num % n == 0){ answer = 1; } else{ answer = 0; } return..

[C] ๋ฐฑ์ค€/BAEKJOON 2839๋ฒˆ: ์„คํƒ• ๋ฐฐ๋‹ฌ

https://www.acmicpc.net/problem/2839 2839๋ฒˆ: ์„คํƒ• ๋ฐฐ๋‹ฌ ์ƒ๊ทผ์ด๋Š” ์š”์ฆ˜ ์„คํƒ•๊ณต์žฅ์—์„œ ์„คํƒ•์„ ๋ฐฐ๋‹ฌํ•˜๊ณ  ์žˆ๋‹ค. ์ƒ๊ทผ์ด๋Š” ์ง€๊ธˆ ์‚ฌํƒ•๊ฐ€๊ฒŒ์— ์„คํƒ•์„ ์ •ํ™•ํ•˜๊ฒŒ Nํ‚ฌ๋กœ๊ทธ๋žจ์„ ๋ฐฐ๋‹ฌํ•ด์•ผ ํ•œ๋‹ค. ์„คํƒ•๊ณต์žฅ์—์„œ ๋งŒ๋“œ๋Š” ์„คํƒ•์€ ๋ด‰์ง€์— ๋‹ด๊ฒจ์ ธ ์žˆ๋‹ค. ๋ด‰์ง€๋Š” 3ํ‚ฌ๋กœ๊ทธ www.acmicpc.net [1] ๋ฌธ์ œ ๋ฌธ์ œ ์ƒ๊ทผ์ด๋Š” ์š”์ฆ˜ ์„คํƒ•๊ณต์žฅ์—์„œ ์„คํƒ•์„ ๋ฐฐ๋‹ฌํ•˜๊ณ  ์žˆ๋‹ค. ์ƒ๊ทผ์ด๋Š” ์ง€๊ธˆ ์‚ฌํƒ•๊ฐ€๊ฒŒ์— ์„คํƒ•์„ ์ •ํ™•ํ•˜๊ฒŒ Nํ‚ฌ๋กœ๊ทธ๋žจ์„ ๋ฐฐ๋‹ฌํ•ด์•ผ ํ•œ๋‹ค. ์„คํƒ•๊ณต์žฅ์—์„œ ๋งŒ๋“œ๋Š” ์„คํƒ•์€ ๋ด‰์ง€์— ๋‹ด๊ฒจ์ ธ ์žˆ๋‹ค. ๋ด‰์ง€๋Š” 3ํ‚ฌ๋กœ๊ทธ๋žจ ๋ด‰์ง€์™€ 5ํ‚ฌ๋กœ๊ทธ๋žจ ๋ด‰์ง€๊ฐ€ ์žˆ๋‹ค. ์ƒ๊ทผ์ด๋Š” ๊ท€์ฐฎ๊ธฐ ๋•Œ๋ฌธ์—, ์ตœ๋Œ€ํ•œ ์ ์€ ๋ด‰์ง€๋ฅผ ๋“ค๊ณ  ๊ฐ€๋ ค๊ณ  ํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, 18ํ‚ฌ๋กœ๊ทธ๋žจ ์„คํƒ•์„ ๋ฐฐ๋‹ฌํ•ด์•ผ ํ•  ๋•Œ, 3ํ‚ฌ๋กœ๊ทธ๋žจ ๋ด‰์ง€ 6๊ฐœ๋ฅผ ๊ฐ€์ ธ๊ฐ€๋„ ๋˜์ง€๋งŒ, 5ํ‚ฌ๋กœ๊ทธ๋žจ 3๊ฐœ์™€ ..

[webhacking.kr] Challange 44

http://webhacking.kr:10005/ Challenge 44 webhacking.kr:10005 [1] ๋ฌธ์ œ ๋ฌธ์ œ ํŽ˜์ด์ง€์™€ ์†Œ์Šค ์ฝ”๋“œ์ด๋‹ค. 1) "name:" ์˜†์— ํ…์ŠคํŠธ๋ฅผ ์ ๊ณ  ์ œ์ถœํ•  ์ˆ˜ ์žˆ๋Š” ํผ์ด ์žˆ๋‹ค. ์ตœ๋Œ€ 5๊ฐœ์˜ ๋ฌธ์ž๊นŒ์ง€ ์ ์„ ์ˆ˜ ์žˆ๋‹ค. 2) ์•„๋ž˜์˜ "view-source"๋ฅผ ๋ˆ„๋ฅด๋ฉด, ์ด๋Ÿฐ ์†Œ์Šค ์ฝ”๋“œ๊ฐ€ ์ ํžŒ ํ™”๋ฉด์ด ๋‚˜์˜จ๋‹ค.

[Dreamhack/๋“œ๋ฆผํ•ต] command-injection-1

https://dreamhack.io/wargame/challenges/44 command-injection-1 ํŠน์ • Host์— ping ํŒจํ‚ท์„ ๋ณด๋‚ด๋Š” ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค. Command Injection์„ ํ†ตํ•ด ํ”Œ๋ž˜๊ทธ๋ฅผ ํš๋“ํ•˜์„ธ์š”. ํ”Œ๋ž˜๊ทธ๋Š” flag.py์— ์žˆ์Šต๋‹ˆ๋‹ค. Reference Introduction of Webhacking dreamhack.io [1] ๋ฌธ์ œ ๋ถ„์„ # ๋ฌธ์ œ ์›น ํŽ˜์ด์ง€ ๋ถ„์„ ์ฒซ ํ™”๋ฉด์ด๋‹ค. ์ƒ๋‹จ์— 'Home' ์˜†์— 'Ping'์„ ๋ˆ„๋ฅด๋ฉด ์ด๋™ํ•˜๋Š” ํŽ˜์ด์ง€์ด๋‹ค. ๋„ค๋ชจ ์นธ์— IP ์ฃผ์†Œ๋ฅผ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์–ด์žˆ๋Š” ๊ฒƒ ๊ฐ™์•˜๊ณ , "Ping!" ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์•˜๋‹ค. โš™๏ธ /ping.html Home Ping Let's ping your host Host Ping! ์ด ํŽ˜์ด์ง€์˜..

[Dreamhack/๋“œ๋ฆผํ•ต] Command Injection Advanced

https://dreamhack.io/wargame/challenges/413 Command Injection Advanced Description Exercise: Command Injection Advanced์—์„œ ์‹ค์Šตํ•˜๋Š” ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ์ˆ˜์ • ๋‚ด์—ญ 2023.07.27 Dockerfile ์ œ๊ณต dreamhack.io [1] ๋ฌธ์ œ ๋ถ„์„ # ์›น ํŽ˜์ด์ง€ ๋ถ„์„ URL์„ ์ œ์ถœํ•  ์ˆ˜ ์žˆ๋Š” ํ˜•์‹์˜ ํผ์ด ์žˆ๋Š” ํŽ˜์ด์ง€์ด๋‹ค. Online Curl Request URL "url" ์ด๋ผ๋Š” ์ด๋ฆ„์˜ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋‚ด๊ฐ€ ์ž…๋ ฅํ•œ ๊ฐ’์ด ๋ฐ›์•„์ ธ์„œ ์ „์†ก์ด ๋˜๋Š” ๊ตฌ์กฐ์ž„์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. . . . ์—ฌ๊ธฐ๊นŒ์ง€๋Š” ์•Œ ์ˆ˜ ์žˆ๋Š” ๊ฒŒ ์—†์–ด์„œ ๋ฐ”๋กœ ๋‹ค์šด๋กœ๋“œํ•œ ํŒŒ์ผ์„ ๋ถ„์„ํ•ด๋ณด๊ฒ ๋‹ค. # ๋‹ค์šด๋กœ๋“œํ•œ ํŒŒ์ผ ๋ถ„์„ โš™๏ธ index.php Online Curl R..

[Dreamhack/๋“œ๋ฆผํ•ต] baby-linux

https://dreamhack.io/wargame/challenges/837 baby-linux Description ๋ฆฌ๋ˆ…์Šค ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์›น ์„œ๋น„์Šค๊ฐ€ ์ž‘๋™ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ์›น ์„œ๋น„์Šค์˜ ์ฝ”๋“œ๊ฐ€ ์ฒจ๋ถ€ํŒŒ์ผ๋กœ ์ฃผ์–ด์ง‘๋‹ˆ๋‹ค. flag.txt ํŒŒ์ผ์„ ์ฐพ์•„ ์ถœ๋ ฅํ•˜์—ฌ ํ”Œ๋ž˜๊ทธ๋ฅผ ํš๋“ํ•˜์„ธ์š”! ํ”Œ๋ž˜๊ทธ ํ˜•์‹์€ DH{...} dreamhack.io [1] ๋ฌธ์ œ ๋ถ„์„ # ์›น ํŽ˜์ด์ง€ ๋ถ„์„ ๋ฌธ์ œ์˜ ์ด๋ฆ„์€ 'Baby linux' ์ด๊ณ , ์ด๋ฆ„์ฒ˜๋Ÿผ ๋ฆฌ๋ˆ…์Šค ๋ช…๋ น์–ด 'echo$( )' ๊ด„ํ˜ธ ์•ˆ์— ๋ฌด์–ธ๊ฐ€๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์ œ์ถœํ•  ์ˆ˜ ์žˆ๋Š” ๊ตฌ์กฐ๋กœ ๋˜์–ด ์žˆ๋‹ค. Baby Linux echo $() Submit Result ๋ฌธ์ œ ํ™”๋ฉด์˜ ์†Œ์Šค ์ฝ”๋“œ์ด๋‹ค. POST ๋ฐฉ์‹์œผ๋กœ ํผ์ด ๊ตฌ์„ฑ๋˜์–ด ์žˆ๊ณ , echo $() ์•ˆ์— ์ž…๋ ฅํ•œ ๊ฐ’์€ "user_input" ..

[C] ๋ฐฑ์ค€/BAEKJOON 2566๋ฒˆ: ์ตœ๋Œ“๊ฐ’

https://www.acmicpc.net/problem/2566 2566๋ฒˆ: ์ตœ๋Œ“๊ฐ’ ์ฒซ์งธ ์ค„์— ์ตœ๋Œ“๊ฐ’์„ ์ถœ๋ ฅํ•˜๊ณ , ๋‘˜์งธ ์ค„์— ์ตœ๋Œ“๊ฐ’์ด ์œ„์น˜ํ•œ ํ–‰ ๋ฒˆํ˜ธ์™€ ์—ด ๋ฒˆํ˜ธ๋ฅผ ๋นˆ์นธ์„ ์‚ฌ์ด์— ๋‘๊ณ  ์ฐจ๋ก€๋กœ ์ถœ๋ ฅํ•œ๋‹ค. ์ตœ๋Œ“๊ฐ’์ด ๋‘ ๊ฐœ ์ด์ƒ์ธ ๊ฒฝ์šฐ ๊ทธ ์ค‘ ํ•œ ๊ณณ์˜ ์œ„์น˜๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค. www.acmicpc.net [2] ์ •๋‹ต ๋ฐ ํ•ด์„ค #include int main() { int maxVal = 0, maxRow = 0, maxCol = 0; int grid[9][9]; // ๊ฒฉ์žํŒ ์ž…๋ ฅ for (int i = 0; i maxVal) { maxVal = gr..

[C] ๋ฐฑ์ค€/BAEKJOON 15649๋ฒˆ: N๊ณผ M (1)

https://www.acmicpc.net/problem/15649 15649๋ฒˆ: N๊ณผ M (1) ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ๋ฌธ์ œ์˜ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜๋Š” ์ˆ˜์—ด์„ ์ถœ๋ ฅํ•œ๋‹ค. ์ค‘๋ณต๋˜๋Š” ์ˆ˜์—ด์„ ์—ฌ๋Ÿฌ ๋ฒˆ ์ถœ๋ ฅํ•˜๋ฉด ์•ˆ๋˜๋ฉฐ, ๊ฐ ์ˆ˜์—ด์€ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ถœ๋ ฅํ•ด์•ผ ํ•œ๋‹ค. ์ˆ˜์—ด์€ ์‚ฌ์ „ ์ˆœ์œผ๋กœ ์ฆ๊ฐ€ํ•˜๋Š” ์ˆœ์„œ๋กœ ์ถœ๋ ฅํ•ด www.acmicpc.net [1] ๋ฌธ์ œ ๋ฌธ์ œ ์ž์—ฐ์ˆ˜ N๊ณผ M์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ์•„๋ž˜ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜๋Š” ๊ธธ์ด๊ฐ€ M์ธ ์ˆ˜์—ด์„ ๋ชจ๋‘ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. 1๋ถ€ํ„ฐ N๊นŒ์ง€ ์ž์—ฐ์ˆ˜ ์ค‘์—์„œ ์ค‘๋ณต ์—†์ด M๊ฐœ๋ฅผ ๊ณ ๋ฅธ ์ˆ˜์—ด ์ž…๋ ฅ ์ฒซ์งธ ์ค„์— ์ž์—ฐ์ˆ˜ N๊ณผ M์ด ์ฃผ์–ด์ง„๋‹ค. (1 ≤ M ≤ N ≤ 8) ์ถœ๋ ฅ ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ๋ฌธ์ œ์˜ ์กฐ๊ฑด์„ ๋งŒ์กฑํ•˜๋Š” ์ˆ˜์—ด์„ ์ถœ๋ ฅํ•œ๋‹ค. ์ค‘๋ณต๋˜๋Š” ์ˆ˜์—ด์„ ์—ฌ๋Ÿฌ ๋ฒˆ ์ถœ๋ ฅํ•˜๋ฉด ์•ˆ๋˜๋ฉฐ, ๊ฐ ์ˆ˜์—ด์€ ๊ณต๋ฐฑ์œผ๋กœ ๊ตฌ๋ถ„ํ•ด์„œ ์ถœ๋ ฅํ•ด..