Skip to content

Commit 177a6ad

Browse files
Merge pull request #433 from Avdhesh-Varshney/insta
[GSSoC'23] Instagram Automation Project Completed
2 parents bcefe73 + 148fee3 commit 177a6ad

3 files changed

Lines changed: 280 additions & 20 deletions

File tree

Instagram-Automation/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# INSTAGRAM AUTOMATION
2+
3+
---
4+
5+
## **Description 📃**
6+
7+
1. This program is related to automation of instagram.
8+
9+
2. This program can take instagram username and password and automate the instagram account of that person.
10+
11+
To use this program read the instructions below.
12+
13+
<br>
14+
15+
## **Modules Used**
16+
17+
- instaloader
18+
- instabot
19+
- random
20+
- os
21+
22+
<br>
23+
24+
## **Functionalities 🎮**
25+
26+
- To use this program first install the PYTHON 3.7 or above on your system.
27+
28+
- Then, install the libraries by using the command ```pip install </Library Name/>```
29+
30+
- Or refer the documentation of that library how to install it.
31+
32+
- Now, You are ready to start the program.
33+
34+
- Enter your instagram username and password.
35+
36+
- Now, enjoy the program.
37+
38+
<br>
39+
40+
## **Working Video 📹**
41+
42+
https://github.com/avinashkranjan/Pentesting-and-Hacking-Scripts/assets/114330097/6b38733e-00ce-472e-a700-5a844646cc29
43+
44+
<br>
45+
46+
## **Developed By 👦**
47+
48+
[Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
49+
50+
<br>
51+
52+
### Thanks for using this program !
53+

Instagram-Automation/insta-auto.py

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
################################################### Instagram Automation ####################################################
2+
################################################ Developed By Avdhesh Varshney ##############################################
3+
############################################ (https://github.com/Avdhesh-Varshney) ##########################################
4+
5+
'''Install Python Packages as listed below using these commands in the terminal
6+
7+
Sr. No. Package Name Commands
8+
1. os pip install os
9+
2. random pip install random
10+
3. instaloader pip install instaloader
11+
4. instabot pip install instabot
12+
13+
After install all these packages then import all of them in this file.'''
14+
15+
# Importing libraries
16+
import os
17+
import random
18+
import instaloader
19+
from instabot import Bot
20+
from time import sleep
21+
22+
os.system("cls" if os.name == "nt" else "clear")
23+
24+
# Global variables for username and password
25+
print("\nWelcome to Instagram Automation 🤖\n")
26+
username = input("Enter your Instagram username: ")
27+
password = input("\nEnter your Instagram password: ")
28+
29+
# Function to tell about your profile id number
30+
def profileIDNumber():
31+
loader = instaloader.Instaloader()
32+
id = instaloader.Profile.from_username(loader.context, username)
33+
34+
print(f"Your profile ID is - {id}")
35+
36+
# Function to download the profile picture of a user using instaloader
37+
def downloadProfilePicture():
38+
loader = instaloader.Instaloader()
39+
# Download the profile picture
40+
loader.download_profile(username, profile_pic_only=True)
41+
42+
print(f"Profile picture of {username} downloaded.")
43+
44+
# Function to like posts from a user's profile using instabot
45+
def likeUserPosts():
46+
bot = Bot()
47+
bot.login(username=username, password=password)
48+
49+
# Get the user's recent posts
50+
userPosts = bot.get_user_medias(username=username, filtration=None)
51+
52+
# Randomly like a few posts
53+
numPostsToLike = min(5, len(userPosts))
54+
postsToLike = random.sample(userPosts, numPostsToLike)
55+
for post in postsToLike:
56+
bot.like(media_id=post.pk)
57+
print(f"Liked post with caption: {post.caption.text}")
58+
59+
bot.logout()
60+
61+
# Function to follow a user using instabot
62+
def followUser():
63+
bot = Bot()
64+
bot.login(username=username, password=password)
65+
66+
# Follow the user
67+
userToFollow = input("\nEnter the username to follow: ")
68+
sleep(60)
69+
bot.follow(userToFollow)
70+
print(f"Followed user: {userToFollow}")
71+
72+
bot.logout()
73+
74+
# Function to unfollow a user using instabot
75+
def unfollowUser():
76+
bot = Bot()
77+
bot.login(username=username, password=password)
78+
79+
# Unfollow the user
80+
userToUnfollow = input("\nEnter the username to unfollow: ")
81+
bot.unfollow(userToUnfollow)
82+
print(f"Unfollowed user: {userToUnfollow}")
83+
84+
bot.logout()
85+
86+
# Function to send a direct message using instabot
87+
def sendDirectMessage():
88+
bot = Bot()
89+
bot.login(username=username, password=password)
90+
91+
# Send the direct message
92+
userToMessage = input("\nEnter the username to send a direct message: ")
93+
message = input("Enter the message: ")
94+
bot.send_message(message, [bot.get_user_id_from_username(userToMessage)])
95+
96+
bot.logout()
97+
98+
# Function to download a user's recent posts and stories using instaloader
99+
def downloadUserData():
100+
loader = instaloader.Instaloader()
101+
profile = instaloader.Profile.from_username(loader.context, username)
102+
103+
# Download recent posts
104+
loader.download_posts(profile, max_count=10)
105+
106+
# Download stories
107+
stories = profile.get_stories()
108+
for story in stories:
109+
loader.download_storyitem(story, filename_prefix=f"{username}_story_")
110+
111+
print(f"Downloaded recent posts and stories of {username}.")
112+
113+
# Function to download multiple profiles using instaloader
114+
def downloadMultipleProfiles():
115+
loader = instaloader.Instaloader()
116+
usernames = input("Enter multiple usernames separated by spaces: ").split()
117+
for user in usernames:
118+
profile = instaloader.Profile.from_username(loader.context, user)
119+
loader.download_profile(profile, download_stories=True)
120+
print("Downloaded profiles and their stories.")
121+
122+
# Function to get hashtag information using instabot
123+
def getHashtagInfo():
124+
bot = Bot()
125+
bot.login(username=username, password=password)
126+
127+
# Get the top posts for the hashtag
128+
hashtag = input("\nEnter the hashtag to get information: ")
129+
topPosts = bot.get_hashtag_medias(hashtag)
130+
131+
print(f"Top posts for the hashtag: {hashtag}")
132+
for post in topPosts:
133+
print(f"Post URL: {post.link}")
134+
135+
bot.logout()
136+
137+
# Main function
138+
def main():
139+
140+
while True:
141+
# Get user's choice
142+
os.system('cls')
143+
print('''\n*********************** Welcome to Instagram Automation 🤖 ***********************\n
144+
\tEnter 1️⃣ to download a user's profile picture
145+
\tEnter 2️⃣ to like posts from a user's profile
146+
\tEnter 3️⃣ to follow a user
147+
\tEnter 4️⃣ to unfollow a user
148+
\tEnter 5️⃣ to send a direct message to a user
149+
\tEnter 6️⃣ to download a user's recent posts and stories
150+
\tEnter 7️⃣ to download multiple profiles and their stories
151+
\tEnter 8️⃣ to get hashtag information
152+
\tEnter 9️⃣ to know you ID number
153+
\tEnter 0️⃣ to exit the program\n''')
154+
155+
try:
156+
value = int(input("Enter your choice: "))
157+
except ValueError:
158+
print("\nInvalid input! Please enter a number from the options.")
159+
continue
160+
161+
os.system('cls')
162+
print("\n*********************** Welcome to Instagram Automation 🤖 ***********************\n")
163+
164+
if value == 0:
165+
os.system('cls')
166+
print("\n******************* Thanks for using Instagram Automation 🤖 Program 👋 *******************\n\n")
167+
exit(0)
168+
169+
elif value == 1:
170+
print("\nDownloading a user's profile picture\n")
171+
downloadProfilePicture()
172+
173+
elif value == 2:
174+
print("\nLiking posts from a user's profile\n")
175+
likeUserPosts()
176+
177+
elif value == 3:
178+
print("\nFollowing a user\n")
179+
followUser()
180+
181+
elif value == 4:
182+
print("\nUnfollowing a user\n")
183+
unfollowUser()
184+
185+
elif value == 5:
186+
print("\nSending a direct message to a user\n")
187+
sendDirectMessage()
188+
189+
elif value == 6:
190+
print("\nDownloading a user's recent posts and stories\n")
191+
downloadUserData()
192+
193+
elif value == 7:
194+
print("\nDownloading multiple profiles and their stories\n")
195+
downloadMultipleProfiles()
196+
197+
elif value == 8:
198+
print("\nGetting hashtag information\n")
199+
getHashtagInfo()
200+
201+
elif value == 9:
202+
print("\nFetching Data\n")
203+
profileIDNumber()
204+
205+
else:
206+
print("\nInvalid choice. Please enter a valid number from the options.\n")
207+
208+
input("\n\nPress 'Enter Key' to continue !\n\n")
209+
210+
# Driver function
211+
if __name__ == "__main__":
212+
main()

SCRIPTS.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,18 @@
5555
| 44\. | Controls open & close apps | This python script can add the functionality of open and close apps of the system. | [Take me](./Open-Close-Apps_Automation)
5656
| 45\. | DNS Dump | This script is a simple Python tool that allows you to retrieve and save a DNS dump image for a specified domain. It utilizes the DNSDumpster service to generate the DNS map image. | [Take me](./DNS_Dump/)
5757
| 46\. | Network Analysis| This Python script is designed to analyze network traffic using the Scapy library. It captures network packets, extracts relevant information, and provides insights into various aspects of the network. | [Take me](./Network Traffic Analyzer/)
58-
| 46\. |Flooder_Sniffer_Spoofer | These scripts utilize various libraries such as subprocess, socket, struct, scapy, and argparse to implement their respective functionalities. | [Take me](./Flooder_Sniffer_Spoofer/)
59-
| 46\. | Github Automation | This python script will automate your github account just input the github access token into this program, then enjoy the program ! | [Take me](./Automate_Github)
60-
| 46\. | Wayback Machine | The script prompts the user to enter a website URL and a limit number, then fetches the archived URLs for the given website from the WayBack Machine and displays them. | [Take me](./Wayback_Machine)
61-
| 47\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files.| [Take me](./File_Server/)
62-
| 48\. | IP Location | An Excellent OSINT tool to get information of any ip address. | [Take me](./IP_Location/)
63-
| 47\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files.| [Take me](./File_Server/)
64-
| 49\. | SpiderFoot Parser | The sf_parser.py script is a Python script that parses JSON files containing SpiderFoot's output. It takes a JSON file as input and displays the parsed data in a table format. The script uses the argparse, huepy, and terminaltables libraries.| [Take me](./SF_Parser/)
65-
| 50\. | Enumerate Forms | This Python script, named "enum_forms," is a command-line utility designed to enumerate and extract form data from a specified URL. The script is useful for analyzing web pages to identify forms, their input elements, and related details.| [Take me](./ENUM_Forms/)
66-
| 51\. | Dumpster Fire | The DumpsterFire Toolset is a Python script that allows users to create, save, load, and ignite custom DumpsterFires, which are collections of "Fires" executed sequentially with optional delays..| [Take me](./Dumpster_Fire/)
67-
| 47\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files.
68-
| [Take me](./File_Server/)
69-
| 50\. | Enumerate Forms | This Python script, named "enum_forms," is a command-line utility designed to enumerate and extract form data from a specified URL. The script is useful for analyzing web pages to identify forms, their input elements, and related details.
70-
| [Take me](./ENUM_Forms/)
71-
| 49\. | SpiderFoot Parser | The sf_parser.py script is a Python script that parses JSON files containing SpiderFoot's output. It takes a JSON file as input and displays the parsed data in a table format. The script uses the argparse, huepy, and terminaltables libraries.
72-
| [Take me](./SF_Parser/)
73-
| 50\. | Dot dot Slash | Python script designed to automate the testing of Path Traversal vulnerabilities in web applications. It is intended for use by security researchers, ethical hackers, and developers to identify and fix potential security issues related to directory traversal
74-
| [Take me](./dotdotslash/)
75-
| 50\. | HackerEnv | hackerEnv is an automation tool that quickly and easily sweep IPs and scan ports, vulnerabilities and exploit them. Then, it hands you an interactive shell for further testing. Also, it generates HTML and docx reports. It uses other tools such as nmap, nikto, metasploit and hydra. Works in kali linux and Parrot OS.
76-
| [Take me](./hackerenv/)
77-
58+
| 47\. |Flooder_Sniffer_Spoofer | These scripts utilize various libraries such as subprocess, socket, struct, scapy, and argparse to implement their respective functionalities. | [Take me](./Flooder_Sniffer_Spoofer/)
59+
| 48\. | Github Automation | This python script will automate your github account just input the github access token into this program, then enjoy the program ! | [Take me](./Automate_Github)
60+
| 49\. | Wayback Machine | The script prompts the user to enter a website URL and a limit number, then fetches the archived URLs for the given website from the WayBack Machine and displays them. | [Take me](./Wayback_Machine)
61+
| 50\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files.| [Take me](./File_Server/)
62+
| 51\. | IP Location | An Excellent OSINT tool to get information of any ip address. | [Take me](./IP_Location/)
63+
| 52\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files.| [Take me](./File_Server/)
64+
| 53\. | SpiderFoot Parser | The sf_parser.py script is a Python script that parses JSON files containing SpiderFoot's output. It takes a JSON file as input and displays the parsed data in a table format. The script uses the argparse, huepy, and terminaltables libraries.| [Take me](./SF_Parser/)
65+
| 54\. | Enumerate Forms | This Python script, named "enum_forms," is a command-line utility designed to enumerate and extract form data from a specified URL. The script is useful for analyzing web pages to identify forms, their input elements, and related details.| [Take me](./ENUM_Forms/)
66+
| 55\. | Dumpster Fire | The DumpsterFire Toolset is a Python script that allows users to create, save, load, and ignite custom DumpsterFires, which are collections of "Fires" executed sequentially with optional delays..| [Take me](./Dumpster_Fire/)
67+
| 56\. | Expose File Server | This script is a Python-based file server that exposes the contents of a specified directory over HTTP. It utilizes the Bottle framework to handle HTTP requests and serve static files. | [Take me](./File_Server/)
68+
| 57\. | Enumerate Forms | This Python script, named "enum_forms," is a command-line utility designed to enumerate and extract form data from a specified URL. The script is useful for analyzing web pages to identify forms, their input elements, and related details. | [Take me](./ENUM_Forms/)
69+
| 58\. | SpiderFoot Parser | The sf_parser.py script is a Python script that parses JSON files containing SpiderFoot's output. It takes a JSON file as input and displays the parsed data in a table format. The script uses the argparse, huepy, and terminaltables libraries. | [Take me](./SF_Parser/)
70+
| 59\. | Dot dot Slash | Python script designed to automate the testing of Path Traversal vulnerabilities in web applications. It is intended for use by security researchers, ethical hackers, and developers to identify and fix potential security issues related to directory traversal | [Take me](./dotdotslash/)
71+
| 60\. | HackerEnv | hackerEnv is an automation tool that quickly and easily sweep IPs and scan ports, vulnerabilities and exploit them. Then, it hands you an interactive shell for further testing. Also, it generates HTML and docx reports. It uses other tools such as nmap, nikto, metasploit and hydra. Works in kali linux and Parrot OS. | [Take me](./hackerenv/)
72+
| 61\. | Instagram Automation | This python script will automate your instagram account just enter your username and password of your account, then enjoy the program ! | [Take me](./Instagram-Automation)

0 commit comments

Comments
 (0)