README
go-instadm : (WIP) Golang smart bot for Instagram DM
⚡ Powerful, customizable and easy to use Instagram dm bot. CLI and GUI interface! Using Selenium webdriver and Yaml configuration files.
Disclaimer: This is a research project. I am in no way responsible for the use you made of this tool. In addition, I am not responsible for any sanctions and/or limitations imposed on your account after using this bot.
Table of Contents
Requirements
- Go (v1.13+)
Features
Check this Project to see all planned features for this tool! Feel free to suggest additional features to implement! 🥳
Installation
Comming soon
Author
👤 Hugo Bollon
- Github: @hbollon
- LinkedIn: @Hugo Bollon
- Portfolio: hugobollon.me
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a ⭐️ if this project helped you!
📝 License
This project is under MIT license.
Documentation
Index ¶
- func DownloadDependencies(downloadBrowsers, downloadLatest, forceDl bool)
- func SimulateHandWriting(element selenium.WebElement, input string) bool
- type Account
- type AutoDM
- type BlacklistManager
- type BotConfig
- type ClientConfig
- type CustomTime
- type QuotaManager
- type SchedulerManager
- type Selenium
- func (s *Selenium) CloseSelenium()
- func (s *Selenium) ConnectToInstagram()
- func (s *Selenium) Fatal(msg string, err error)
- func (s *Selenium) GetElement(elementTag, locator string) (selenium.WebElement, error)
- func (s *Selenium) InitChromeWebDriver()
- func (s *Selenium) InitFirefoxWebDriver()
- func (s *Selenium) InitializeSelenium(clientConfig *ClientConfig)
- func (s *Selenium) IsElementPresent(by, value string) bool
- func (s *Selenium) SendMessage(user, message string) (bool, error)
- func (s *Selenium) WaitForElement(elementTag, locator string, delay int) (bool, error)
Constants ¶
Variables ¶
Functions ¶
func DownloadDependencies ¶
func DownloadDependencies(downloadBrowsers, downloadLatest, forceDl bool)
DownloadDependencies automate selenium dependencies downloading (ChromeDriver binary, the Firefox binary, the Selenium WebDriver JARs, and the Sauce Connect proxy binary)
func SimulateHandWriting ¶
func SimulateHandWriting(element selenium.WebElement, input string) bool
SimulateHandWriting simulate human writing by typing input string character by character with random interruptions between letters
Types ¶
type AutoDM ¶
type AutoDM struct { Activated bool `yaml:"activated"` // List of all availlables message templates DmTemplates []string `yaml:"dm_templates"` // Greeting module add a customized DM header with recipient username Greeting struct { Activated bool `yaml:"activated"` // Add a string before the username Template string `yaml:"template"` } `yaml:"greeting"` }
AutoDM store messaging module configuration
type BlacklistManager ¶
type BlacklistManager struct { // BlacklistedUsers: list of all blacklisted usernames BlacklistedUsers [][]string // Activated: quota manager activation boolean Activated bool `yaml:"activated"` }
BlacklistManager data
func (*BlacklistManager) AddUser ¶
func (bm *BlacklistManager) AddUser(user string)
AddUser add argument username to the blacklist
func (*BlacklistManager) InitializeBlacklist ¶
func (bm *BlacklistManager) InitializeBlacklist() error
InitializeBlacklist check existence of the blacklist csv file and initialize it if it doesn't exist.
func (*BlacklistManager) IsBlacklisted ¶
func (bm *BlacklistManager) IsBlacklisted(user string) bool
IsBlacklisted check if the given user is already blacklisted
type BotConfig ¶
type BotConfig struct { // User credentials UserAccount Account `yaml:"account"` // Automatic messages sending module DmModule AutoDM `yaml:"auto_dm"` // Quotas Quotas QuotaManager `yaml:"quotas"` // Scheduler Scheduler SchedulerManager `yaml:"schedule"` // Interracted users blacklist Blacklist BlacklistManager `yaml:"blacklist"` }
BotConfig struct store all bot and ig related configuration . These parameters are readed from Yaml config files.
type ClientConfig ¶
type ClientConfig struct { // LogLevel set loglevel threshold // If undefined or wrong set it to INFO level LogLevel logrus.Level // ForceDependenciesDl force re-download of all dependencies ForceDependenciesDl bool // Debug set selenium debug mode and display its logging to stderr Debug bool // IgnoreDependencies disable dependencies manager on startup IgnoreDependencies bool // Headless execute Selenium webdriver in headless mode Headless bool // Port : communication port Port uint16 BotConfig BotConfig }
ClientConfig struct centralize all client configuration and flags. Inizialized at program startup, not safe to modify this after.
func CreateClientConfig ¶
func CreateClientConfig() *ClientConfig
CreateClientConfig create default ClientConfig instance and return a pointer on it
type CustomTime ¶
CustomTime is a custom time.Time used to set a custom yaml unmarshal rule
func (*CustomTime) UnmarshalYAML ¶
func (t *CustomTime) UnmarshalYAML(unmarshal func(interface{}) error) error
type QuotaManager ¶
type QuotaManager struct { // HourTimestamp: hourly timestamp used to handle hour limitations HourTimestamp time.Time // DayTimestamp: daily timestamp used to handle day limitations DayTimestamp time.Time // DmSent: quantity of dm sent in the last hour DmSent int // DmSentDay: quantity of dm sent in the last day DmSentDay int // MaxDmHour: maximum dm quantity per hour MaxDmHour int `yaml:"dm_per_hour"` // MaxDmDay: maximum dm quantity per day MaxDmDay int `yaml:"dm_per_day"` // Activated: quota manager activation boolean Activated bool `yaml:"activated"` }
QuotaManager data
func (*QuotaManager) AddDm ¶
func (qm *QuotaManager) AddDm()
AddDm report to the manager a message sending. It increment dm counter and check if quotas are still valid.
func (*QuotaManager) CheckQuotas ¶
func (qm *QuotaManager) CheckQuotas()
CheckQuotas check if quotas have not been exceeded and pauses the program otherwise.
func (*QuotaManager) InitializeQuotaManager ¶
func (qm *QuotaManager) InitializeQuotaManager()
InitializeQuotaManager initialize Quota manager with user settings
func (*QuotaManager) ResetDailyQuotas ¶
func (qm *QuotaManager) ResetDailyQuotas()
ResetDailyQuotas reset daily dm counter and update timestamp
func (*QuotaManager) ResetHourlyQuotas ¶
func (qm *QuotaManager) ResetHourlyQuotas()
ResetHourlyQuotas reset hourly dm counter and update timestamp
type SchedulerManager ¶
type SchedulerManager struct { // HourTimestamp: hourly timestamp used to handle hour limitations BeginAt CustomTime `yaml:"begin_at"` // DayTimestamp: daily timestamp used to handle day limitations EndAt CustomTime `yaml:"end_at"` // Activated: quota manager activation boolean Activated bool `yaml:"activated"` }
SchedulerManager data
func (*SchedulerManager) CheckTime ¶
func (s *SchedulerManager) CheckTime() error
CheckTime check scheduler and pause the bot if it's not working time
type Selenium ¶
type Selenium struct { Instance *selenium.Service Config *ClientConfig Opts []selenium.ServiceOption WebDriver selenium.WebDriver }
Selenium instance and opts
func (*Selenium) CloseSelenium ¶
func (s *Selenium) CloseSelenium()
CloseSelenium close webdriver and selenium instance
func (*Selenium) ConnectToInstagram ¶
func (s *Selenium) ConnectToInstagram()
ConnectToInstagram get ig login webpage and connect user account
func (*Selenium) GetElement ¶
func (s *Selenium) GetElement(elementTag, locator string) (selenium.WebElement, error)
GetElement wait for element and then return when it is available
func (*Selenium) InitChromeWebDriver ¶
func (s *Selenium) InitChromeWebDriver()
InitChromeWebDriver init and launch web driver with Chrome
func (*Selenium) InitFirefoxWebDriver ¶
func (s *Selenium) InitFirefoxWebDriver()
InitFirefoxWebDriver init and launch web driver with Firefox
func (*Selenium) InitializeSelenium ¶
func (s *Selenium) InitializeSelenium(clientConfig *ClientConfig)
InitializeSelenium start a Selenium WebDriver server instance (if one is not already running).
func (*Selenium) IsElementPresent ¶
IsElementPresent check if an element is present on the current webpage
func (*Selenium) SendMessage ¶
SendMessage navigate to Instagram direct message interface and send one to specified user by simulating human typing
Source Files
Directories
Path | Synopsis |
---|---|
cmd/go-instadm |