๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • Tried. Failed. Logged.
728x90

๐Ÿ‘จ๐Ÿผโ€๐Ÿ’ป๊ฐœ๋ฐœ158

์…€๋ ˆ๋‹ˆ์›€ - ์•ˆํ‹ฐ๋ด‡ ํ™•์ธ ์‚ฌ์ดํŠธ https://bot.sannysoft.com/ Antibot bot.sannysoft.com 2022. 10. 12.
puppeteer - navigator.webdriver ํƒ์ง€ ์šฐํšŒ navigator.userAgentData์— ์ด์–ด์„œ navigator.webdriver๋„ ํƒ์ง€๋ฅผ ํ•˜์—ฌ์„œ ํฌ๋กฌ ์ž๋™ํ™” ํˆด์ธ์ง€๋ฅผ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์•„๋ž˜ ๊ธ€์— ์ ํ˜€์žˆ๋‹ค. https://economytrendstory.com/1174 ํฌ๋กฌ ์ž๋™ํ™” ํˆด selenium์€ ํƒ์ง€ํ•˜๋Š” ๋ฒ• 4๊ฐ€์ง€ selenium์€ ํƒ์ง€๊ฐ€ ๋ถˆ๊ฐ€๋Šฅ ํ• ๊นŒ์š”?์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ์…€๋ ˆ๋‹ˆ์›€์„ ํƒ์ง€ ํ•  ์ˆ˜ ์žˆ์„์ง€ ํ™•์ธํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. navigator.webdriver ํ™•์ธClient hints, navigator.userAgentData ํ™•์ธchromedriver ํƒ์ง€๋ธŒ๋ผ์šฐ์ € ์ง€๋ฌธ(browser fingerprin economytrendstory.com ์‹ค์ œ๋กœ ์…€๋ ˆ๋‹ˆ์›€ ํฌ๋กฌ๊ณผ ์ผ๋ฐ˜ ํฌ๋กฌ์˜ ๊ฒฐ๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ ๋‚˜์™”๋‹ค. navigator.webdriver๋„ navi.. 2022. 10. 11.
puppeteer - UserAgent์™€ UserAgentData ๋ณ€๊ฒฝ ํ•˜๊ธฐ ์†Œ์Šค const page = await browser.newPage(); await page.setUserAgent('MyBrowser', { architecture: 'My1', mobile: false, model: 'Mybook', platform: 'MyOS', platformVersion: '3.1', }); ํด๋ผ์ด์–ธํŠธ ์š”์ฒญ ํ—ค๋” ํ™•์ธํ•˜๋Š” ์‚ฌ์ดํŠธ https://www.httpbin.org/headers ์ถœ์ฒ˜: https://stackoverflow.com/questions/73344280/how-to-overwrite-the-user-agent-client-hints-in-puppeteer How to overwrite the User-Agent Client Hints in puppeteer? .. 2022. 10. 11.
์…€๋ ˆ๋‹ˆ์›€ - ํŠน์ • URL ์ฐจ๋‹จํ•˜๊ธฐ chromeOptions.AddArgument("--host-resolver-rules=MAP ssl.pstatic.net 127.0.0.1"); string strCmdText; strCmdText = "/C ipconfig /flushdns"; System.Diagnostics.Process.Start("CMD.exe", strCmdText); Thread.Sleep(3000); URL์˜ DNS๋ฅผ 127.0.0.1๋กœ ์„ค์ •ํ•ด์„œ ์ฐจ๋‹จํ•˜๋Š” ๋ฐฉ์‹์ด๋ผ ๋ฐ”๋กœ ์ ์šฉํ•˜๊ณ  ์‹ถ์œผ๋ฉด dns๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๋Š” ๋ช…๋ น์–ด๋„ ํ•จ๊ป˜ ์จ์ค˜์•ผ ํ•จ ์ถœ์ฒ˜: ์…€๋ ˆ๋‹ˆ์›€ URL Blocking https://stackoverflow.com/questions/46891301/can-i-automate-chrome-request-blocking-usi.. 2022. 10. 11.
์…€๋ ˆ๋‹ˆ์›€ - navigator.userAgentData ๋ชจ๋ฐ”์ผ๋กœ ์œ„์žฅํ•˜๊ธฐ ์ฐธ๊ณ  https://economytrendstory.com/1174 ํฌ๋กฌ ์ž๋™ํ™” ํˆด selenium์€ ํƒ์ง€ํ•˜๋Š” ๋ฒ• 4๊ฐ€์ง€ selenium์€ ํƒ์ง€๊ฐ€ ๋ถˆ๊ฐ€๋Šฅ ํ• ๊นŒ์š”?์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ์…€๋ ˆ๋‹ˆ์›€์„ ํƒ์ง€ ํ•  ์ˆ˜ ์žˆ์„์ง€ ํ™•์ธํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค. navigator.webdriver ํ™•์ธClient hints, navigator.userAgentData ํ™•์ธchromedriver ํƒ์ง€๋ธŒ๋ผ์šฐ์ € ์ง€๋ฌธ(browser fingerprin economytrendstory.com ๋ฐฉ๋ฒ• 1. ๊ฐœ๋ฐœ์ž ๋„๊ตฌ(F12)์—์„œ "๊ธฐ๊ธฐ ํˆด๋ฐ” ์ „ํ™˜" ์‚ฌ์šฉ ์œ„์˜ ๊ธ€์„ ๋ณด๋ฉด navigator.userAgentData์•ˆ์— ์žˆ๋Š” mobile, platform ๊ฐ™์€ ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒŒ ํž˜๋“ค๋‹ค๊ณ  ์–ธ๊ธ‰์„ ํ•˜๋Š”๋ฐ ์˜์™ธ๋กœ ์šฐํšŒํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๊ฐ„๋‹จํ•˜๋‹ค. (๊ธฐ์กด์—๋Š” mobile=.. 2022. 10. 11.
C# - ๋น„์ฃผ์–ผ ์ŠคํŠœ๋””์˜ค, ์ฝ”๋“œ๊ฐ€ ์ ์šฉ์ด ์•ˆ๋˜๊ณ  ์ด์ „ ๊ฒƒ์œผ๋กœ ์‹คํ–‰ ๋˜๋Š” ๊ฒฝ์šฐ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๋นŒ๋“œ(B) > ์†”๋ฃจ์…˜ ์ •๋ฆฌ(C) 2022. 10. 11.
C# - ๋“œ๋ž˜๊ทธ ์•ค ๋“œ๋กญ(Drag & Drop) public partial class Form1 : Form { public Form1() { InitializeComponent(); this.AllowDrop = true; this.DragEnter += new DragEventHandler(Form1_DragEnter); this.DragDrop += new DragEventHandler(Form1_DragDrop); } void Form1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy; } void Form1_DragDrop(object sender, DragEventAr.. 2022. 10. 9.
C# - DateTime D-Day ๊ตฌํ•˜๊ธฐ(TimeSpan) D-Day ๊ตฌํ•˜๊ธฐ System.DateTime Time = new System.DateTime(2022, 12, 05); TimeSpan resultTime = Time - DateTime.Now; Console.writeLine("D-Days: " + resultTime.Days); ํŒŒ์ผ ๋งˆ์ง€๋ง‰ ์ˆ˜์ •์ผ ๊ฒฝ๊ณผ ์ผ ๊ตฌํ•˜๊ธฐ DateTime LastWriten = File.GetLastWriteTime("memo.txt"); TimeSpan resultTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day) - new DateTime(LastWriten.Year, LastWriten.Month, LastWriten.Day); if.. 2022. 10. 8.
ํŒŒ์ด์ฌ - ์Šฌ๋ผ์ด์Šค(Slice) ์Šฌ๋ผ์ด์Šค(Slice) ์Šฌ๋ผ์ด์Šค๋Š” ๋ฌธ์ž์—ด์ด๋‚˜ ๋ฆฌ์ŠคํŠธ์™€ ๊ฐ™์€ ์ˆœ์ฐจํ˜• ๊ฐ์ฒด์—์„œ ์ผ๋ถ€๋ฅผ ์ž˜๋ผ(Slicing) ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค. ํ˜•์‹ ๊ฐ์ฒด๋ช…[์ดˆ๊ธฐ์œ„์น˜:์ตœ์ข…์œ„์น˜] # '์ดˆ๊ธฐ์œ„์น˜'์—์„œ '์ตœ์ข…์œ„์น˜'-1๊นŒ์ง€์˜ ์š”์†Œ๋“ค์„ ๊ฐ€์ ธ์˜จ๋‹ค. ๊ฐ์ฒด๋ช…[์ดˆ๊ธฐ์œ„์น˜:์ตœ์ข…์œ„์น˜:์ฆ๊ฐ€๊ฐ’] # '์ดˆ๊ธฐ์œ„์น˜'์—์„œ '์ตœ์ข…์œ„์น˜'-1๊นŒ์ง€์˜ '์ฆ๊ฐ€๊ฐ’'๋งŒํผ ์ฆ๊ฐ€ํ•˜๋ฉด์„œ ํ•ด๋‹น ์œ„์น˜์˜ ์š”์†Œ๋“ค์„ ๊ฐ€์ ธ์˜จ๋‹ค. ์Šฌ๋ผ์ด์Šค๋Š” ์ผ๋ถ€ ์ธ์ˆ˜๋ฅผ ์ƒ๋žตํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์ฒด๋ช…[:] ๋˜๋Š” ๊ฐ์ฒด๋ช…[::] # ๊ฐ์ฒด์˜ ๋ชจ๋“  ์š”์†Œ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ๊ฐ์ฒด๋ช…[์ดˆ๊ธฐ์œ„์น˜:] # ๊ฐ์ฒด์˜ '์ดˆ๊ธฐ์œ„์น˜'์—์„œ ๋งˆ์ง€๋ง‰ ์œ„์น˜๊นŒ์ง€์˜ ์š”์†Œ๋“ค์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ๊ฐ์ฒด๋ช…[:์ตœ์ข…์œ„์น˜] # ๊ฐ์ฒด์˜ 0๋ฒˆ์งธ ์œ„์น˜์—์„œ '์ตœ์ข…์œ„์น˜'-1๊นŒ์ง€์˜ ์š”์†Œ๋“ค์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ๊ฐ์ฒด๋ช…[::์ฆ๊ฐ€๊ฐ’] # ๊ฐ์ฒด์˜ 0๋ฒˆ์งธ ์œ„์น˜์—์„œ ๋งˆ์ง€๋ง‰ ์œ„์น˜๊นŒ์ง€ '์ฆ๊ฐ€๊ฐ’'.. 2022. 10. 6.
ํŒŒ์ด์ฌ - Range ๋ฒ”์œ„ Range Range๋Š” ์—ฐ์†๋œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ์œผ๋กœ, ๋ฆฌ์ŠคํŠธ๋‚˜ ๋ฐ˜๋ณต๋ฌธ์—์„œ ๋งŽ์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ํ˜•์‹ range(์ตœ์ข…๊ฐ’) # 0์—์„œ '์ตœ์ข…๊ฐ’'-1๊นŒ์ง€ ์—ฐ์†๋œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. range(์ดˆ๊ธฐ๊ฐ’, ์ตœ์ข…๊ฐ’) # '์ดˆ๊ธฐ๊ฐ’'์—์„œ '์ตœ์ข…๊ฐ’'-1๊นŒ์ง€ ์—ฐ์†๋œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. range(์ดˆ๊ธฐ๊ฐ’, ์ตœ์ข…๊ฐ’, ์ฆ๊ฐ€๊ฐ’) # '์ดˆ๊ธฐ๊ฐ’'์—์„œ '์ตœ์ข…๊ฐ’'-1๊นŒ์ง€ '์ฆ๊ฐ€๊ฐ’'๋งŒํผ ์ฆ๊ฐ€ํ•˜๋ฉด์„œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. ์˜ˆ์‹œ range(5) => [0, 1, 2, 3, 4] # 0๋ถ€ํ„ฐ ์ตœ์ข…๊ฐ’(5)-1๊นŒ์ง€ ์—ฐ์†๋œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. range(1, 5) => [1, 2, 3, 4] # ์ดˆ๊ธฐ๊ฐ’(1)๋ถ€ํ„ฐ ์ตœ์ข…๊ฐ’(5)-1๊นŒ์ง€ ์—ฐ์†๋œ ์ˆซ์ž๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. range(1, 5, 2) => [1, 3] # ์ดˆ๊ธฐ๊ฐ’(1)๋ถ€ํ„ฐ ์ตœ์ข…๊ฐ’(5)-1๊นŒ์ง€ ์ฆ๊ฐ€๊ฐ’(2)๋งŒํผ ์ฆ๊ฐ€ํ•˜๋ฉด์„œ.. 2022. 10. 6.
C# - CookieContainer ์ฟ ํ‚ค ๊ฐ’ ๊ฐ€์ ธ์˜ค๊ธฐ CookieContainer cookies = new CookieContainer(); cookies.Add(new Cookie("name1", "value1", "/", "www.domain1.com")); cookies.Add(new Cookie("name2", "value2", "/", "www.domain2.com")); Hashtable table = (Hashtable)cookies.GetType().InvokeMember("m_domainTable", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance, null, cookies, new object[] { }); foreach (var key in table.Keys.. 2022. 10. 3.
C# - RichTextBox ์ƒ‰๊น” ์ง€์ • void AppendRichText(RichTextBox box, string text, Color color) { box.SelectionStart = box.TextLength; box.SelectionLength = 0; box.SelectionColor = color; box.AppendText(text + "\n"); box.SelectionColor = box.ForeColor; } ์ถœ์ฒ˜: https://stackoverflow.com/questions/1926264/color-different-parts-of-a-richtextbox-string Color different parts of a RichTextBox string I'm trying to color parts of a strin.. 2022. 9. 29.
728x90