instadm

package module
v0.0.0-...-bbe6a38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 28 Imported by: 0

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

🀝 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 ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

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 Account ΒΆ

type Account struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

Account store personnal credentials

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 ΒΆ

type CustomTime struct {
	time.Time
}

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) Fatal ΒΆ

func (s *Selenium) Fatal(msg string, err error)

Fatal closes all selenium stuff and call logrus fatal with error printing

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 ΒΆ

func (s *Selenium) IsElementPresent(by, value string) bool

IsElementPresent check if an element is present on the current webpage

func (*Selenium) SendMessage ΒΆ

func (s *Selenium) SendMessage(user, message string) (bool, error)

SendMessage navigate to Instagram direct message interface and send one to specified user by simulating human typing

func (*Selenium) WaitForElement ΒΆ

func (s *Selenium) WaitForElement(elementTag, locator string, delay int) (bool, error)

WaitForElement search and wait until searched element appears. Delay argument is in seconds.

Directories ΒΆ

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL