{"id":814,"date":"2023-10-06T18:56:32","date_gmt":"2023-10-06T18:56:32","guid":{"rendered":"https:\/\/hacking.cool\/?p=814"},"modified":"2024-03-19T20:18:57","modified_gmt":"2024-03-19T20:18:57","slug":"starting-with-python-for-hacking","status":"publish","type":"post","link":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/","title":{"rendered":"Starting with Python for Hacking"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"585\" src=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5-1024x585.webp\" alt=\"\" class=\"wp-image-915\" srcset=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5-1024x585.webp 1024w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5-300x171.webp 300w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5-768x439.webp 768w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5-1536x878.webp 1536w, https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2024\/03\/4750b319-bf8f-4938-9722-47bedc649de5.webp 1792w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p class=\"has-black-color has-text-color\">One of the most important things one can learn for hacking is getting comfy with programming. Python is a good language to start. <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">Another very important aspect of hacking is &#8211; SEARCH ENGINES. It stands to reason to combine searching and programming.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">First, install the necessary library:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install googlesearch-python<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color\">This is how a request to google looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try:\n    from googlesearch import search\nexcept ImportError: \n    print(\"No module named 'google' found\")\n \n# to search\nt=input()\nquery = t\n \nfor j in search(query, tld=\"co.in\", num=10, stop=10, pause=2):\n    print(j)\n<\/code><\/pre>\n\n\n\n<p class=\"has-black-color has-text-color\">Simple. Try it out.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-black-color has-text-color\">Arguments of search function:<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>query: <\/strong>query string that we want to search for.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>TLD: <\/strong>TLD stands for the top-level domain which means we want to search our results on google.com or google. in or some other domain.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>lang: <\/strong>lang stands for language.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>num: <\/strong>Number of results we want.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>start: <\/strong>The first result to retrieve.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>stop: <\/strong>The last result to retrieve. Use None to keep searching forever.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>pause: <\/strong>Lapse to wait between HTTP requests. Lapse too short may cause Google to block your IP. Keeping significant lapses will make your program slow but it\u2019s a safe and better option.<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\" style=\"font-size:15px\"><strong>Return: <\/strong>Generator (iterator) that yields found URLs. If the stop parameter is None the iterator will loop forever.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-black-color has-cyan-bluish-gray-background-color has-text-color has-background\"><strong>How to search for python info:<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">If you don&#8217;t know what certain function does, get into a habit of searching it in proper locations!<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">One such location is: <strong>https:\/\/docs.python.org\/3\/<\/strong><\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">Another resource &#8211; good for checking additional modules documentations: <strong>https:\/\/pypi.org\/project\/<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-black-color has-text-color\">For example, in our program we use googlesearch module, and here is its description: https:\/\/pypi.org\/project\/google\/, and from there we get to the homepage of the module author and its documentation: https:\/\/breakingcode.wordpress.com\/2010\/06\/29\/google-search-python\/ and the source code: https:\/\/github.com\/MarioVilas\/googlesearch\/blob\/master\/googlesearch\/init.py<\/p>\n\n\n\n<p class=\"has-black-color has-text-color\"><\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">Yup, if you are going to program you will have to learn to navigate, search, effectively lookup for functions and modules, and sometimes even check their source codes (if no documentation is out there, but that happens rarely). Also, never forget to GOOGLE &#8211; GOOGLE stuff, you will find tons of tutorials with examples of specific functions.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the most important things one can learn for hacking is getting comfy with programming. Python is a good language to start. Another very important aspect of hacking is &#8211; SEARCH ENGINES. It stands to reason to combine searching and programming. First, install the necessary library: This is how a request to google looks<span class=\"post-excerpt-end\">&hellip;<\/span><\/p>\n<p class=\"more-link\"><a href=\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":3,"featured_media":876,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-814","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Starting with Python for Hacking - hacking.cool<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Starting with Python for Hacking - hacking.cool\" \/>\n<meta property=\"og:description\" content=\"One of the most important things one can learn for hacking is getting comfy with programming. Python is a good language to start. Another very important aspect of hacking is &#8211; SEARCH ENGINES. It stands to reason to combine searching and programming. First, install the necessary library: This is how a request to google looks&hellip;Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\" \/>\n<meta property=\"og:site_name\" content=\"hacking.cool\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-06T18:56:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-19T20:18:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png\" \/>\n\t<meta property=\"og:image:width\" content=\"811\" \/>\n\t<meta property=\"og:image:height\" content=\"412\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Atom\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Atom\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#website\",\"url\":\"https:\/\/hacking.cool\/atomanya\/\",\"name\":\"hacking.cool\",\"description\":\"is the hacking school \ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb\ud83e\uddd1\ud83c\udffb\u200d\ud83d\udcbb\ud83d\uddfa\ud83d\udcda\ud83d\udcd6\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hacking.cool\/atomanya\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#primaryimage\",\"url\":\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png\",\"contentUrl\":\"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png\",\"width\":811,\"height\":412},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\",\"url\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\",\"name\":\"Starting with Python for Hacking - hacking.cool\",\"isPartOf\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#primaryimage\"},\"datePublished\":\"2023-10-06T18:56:32+00:00\",\"dateModified\":\"2024-03-19T20:18:57+00:00\",\"author\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2\"},\"breadcrumb\":{\"@id\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hacking.cool\/atomanya\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Starting with Python for Hacking\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2\",\"name\":\"Atom\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g\",\"caption\":\"Atom\"},\"url\":\"https:\/\/hacking.cool\/atomanya\/author\/atom\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Starting with Python for Hacking - hacking.cool","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/","og_locale":"en_US","og_type":"article","og_title":"Starting with Python for Hacking - hacking.cool","og_description":"One of the most important things one can learn for hacking is getting comfy with programming. Python is a good language to start. Another very important aspect of hacking is &#8211; SEARCH ENGINES. It stands to reason to combine searching and programming. First, install the necessary library: This is how a request to google looks&hellip;Read More","og_url":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/","og_site_name":"hacking.cool","article_published_time":"2023-10-06T18:56:32+00:00","article_modified_time":"2024-03-19T20:18:57+00:00","og_image":[{"width":811,"height":412,"url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png","type":"image\/png"}],"author":"Atom","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Atom","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/hacking.cool\/atomanya\/#website","url":"https:\/\/hacking.cool\/atomanya\/","name":"hacking.cool","description":"is the hacking school \ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb\ud83e\uddd1\ud83c\udffb\u200d\ud83d\udcbb\ud83d\uddfa\ud83d\udcda\ud83d\udcd6","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hacking.cool\/atomanya\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#primaryimage","url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png","contentUrl":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png","width":811,"height":412},{"@type":"WebPage","@id":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/","url":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/","name":"Starting with Python for Hacking - hacking.cool","isPartOf":{"@id":"https:\/\/hacking.cool\/atomanya\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#primaryimage"},"datePublished":"2023-10-06T18:56:32+00:00","dateModified":"2024-03-19T20:18:57+00:00","author":{"@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2"},"breadcrumb":{"@id":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/hacking.cool\/atomanya\/starting-with-python-for-hacking\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hacking.cool\/atomanya\/"},{"@type":"ListItem","position":2,"name":"Starting with Python for Hacking"}]},{"@type":"Person","@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/804a839cfa61d89d69fb2cf1d2f0adc2","name":"Atom","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hacking.cool\/atomanya\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ac4d05ec7d617e7f2dee5855900a855a?s=96&d=mm&r=g","caption":"Atom"},"url":"https:\/\/hacking.cool\/atomanya\/author\/atom\/"}]}},"jetpack_featured_media_url":"https:\/\/hacking.cool\/atomanya\/wp-content\/uploads\/2023\/10\/3222222222222.png","_links":{"self":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/comments?post=814"}],"version-history":[{"count":34,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/814\/revisions"}],"predecessor-version":[{"id":931,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/posts\/814\/revisions\/931"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/media\/876"}],"wp:attachment":[{"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/media?parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/categories?post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hacking.cool\/atomanya\/wp-json\/wp\/v2\/tags?post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}