{"id":16960569,"url":"https://github.com/randomfractals/cyberdash","last_synced_at":"2025-04-11T22:10:47.134Z","repository":{"id":101631345,"uuid":"113374577","full_name":"RandomFractals/CyberDash","owner":"RandomFractals","description":"code behind @WebDevCreations @WebPackSense and @CyberDash Twitter bots","archived":false,"fork":false,"pushed_at":"2018-01-10T20:20:07.000Z","size":16314,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T18:08:09.364Z","etag":null,"topics":["cyber-security","nodejs","twitter-bot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RandomFractals.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-06T22:37:31.000Z","updated_at":"2023-02-17T04:11:07.000Z","dependencies_parsed_at":"2023-06-07T00:45:22.060Z","dependency_job_id":null,"html_url":"https://github.com/RandomFractals/CyberDash","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RandomFractals%2FCyberDash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RandomFractals%2FCyberDash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RandomFractals%2FCyberDash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RandomFractals%2FCyberDash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RandomFractals","download_url":"https://codeload.github.com/RandomFractals/CyberDash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487695,"owners_count":21112191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cyber-security","nodejs","twitter-bot"],"created_at":"2024-10-13T22:49:25.790Z","updated_at":"2025-04-11T22:10:47.123Z","avatar_url":"https://github.com/RandomFractals.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CyberDash - smarter Twitter news bot\n\nThis simple keywords search Twitter bot was originally created to keep up with cyberSec news and seed Dasher: https://twitter.com/CyberDash\n\nI extended it for the webpack dev community as an experiment to guage webpack feedback in its second incarnation. See it running in a hybrid mode at https://twitter.com/WebPackSense and scroll down for more info.\n\nv3.0 of this bot for webdevs: https://twitter.com/WebDevCreations\n\nYou can use this node.js Twitter bot code to create your own Twitter news feed for the topics of your interest, or for augmenting your existing Twitter account to become a subject matter expert in your domain, as most top Twitter 'influencers' do :) Just follow the build, config, test, debug, run and bot deploy instructions below.\n\nBe creative! Fork and mode it at will!\n\nWhere I started:\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/CyberDash1.0.png?raw=true \n \"@CyberDash\")\n\nAfter 2 days of bot training and config tweaking :)\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/CyberDashTrainingDay2.png?raw=true \n \"@CyberDash\")\n\n# Build\n\n\u003enpm install\n\n# Config: save .env.template as .env\n\nFollow instructions in .env.template for your Twitter bot config:\n\n```\n# Create new Twitter bot account and get API keys\n#\n# https://apps.twitter.com/ \n\n# Your Twitter bot name\nTWITTER_ACCOUNT=CyberDash\n\n# Greeting to DM new followers\nGREETING=Hello friend.\n\n# Realtime tweets track filter\n# see https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter.html\n# List of keywords to match for your Twitter bot to retweet\nTRACK_FILTER=cyberSec,infoSec,hacking,penTest,cyberThreat,cyberAttack,cyberCrime,MrRobot\n\n# Twitter bot search query for search/tweets interface\nSEARCH_QUERY=#cyberSec #hacking AND -filter:replies AND -filter:retweets\n\n# Hashtags only filter match toggle\nHASHTAGS_FILTER=true\n\n# Skip tweets with these keywords\nMUTE_TWEET_FILTER=attend,join us,join our,summit,webinar,daily,predictions,easy steps,top,register,meetup,job,marketing,agency,digest,template\n\n# Skip tweets with these links\nMUTE_TWEET_LINKS_FILTER=reddit.com,paper.li,youtube.com,youtu.be,goog.gl,ift.tt,dlvr.it,plow.io,live24u.com,jobs,magazine,.tv,lnkd.in,linkedin.com,egghead.io,spotify.com\n\n# Name of the 'blacklist' Twitter list to skip tweets from the members of\n# Note: can be any public or private Twitter list you create and curate\nBLACKLIST=blacklist\n\n# Skip tweets from news bots, companies, magazines, 'celebrities' and support 'providers'\n# Add other 'mute' user profile description keywords as desired\nMUTE_USER_FILTER=publish,news,marketing,award-winning,best-selling,co-author,speaker,influencer,firm,company,magazine,provide,support,events,tutorials,courses,founder,contact,wordpress,job,template,recruit,stories,books,special,buy,products\n\n# Minimum followers to RT a tweet from 'unknown' user\nMIN_USER_FOLLOWERS=1000\n\n# Minimum required twitter user frinds to consider sharing their content\nMIN_USER_FRIENDS=100\n\n# Skip tweets from tweeps with these many 'friends', bound to be Twitter spam users\nMAX_USER_FRIENDS=50000\n\n# Minimum required user tweets to RT a post from 'unknown' user\nMIN_USER_TWEETS=5000\n\n# Skip tweets from users with these many posts, most likely just another bot\nMAX_USER_TWEETS=50000\n\n# Skip tweets with more than these many hashtags, most likely marketing spam bot\nMAX_TWEET_HASHTAGS=6\n\n# Max retweets per user per hour\nHOURLY_USER_QUOTA=3\n\n# Max bot retweets per hour\nHOURLY_RETWEET_QUOTA=10\n\n# Search and like mentions flag\nLIKE_MENTIONS=true\n\n# Auto-like retweeted tweets. Set to true to enable it\nLIKE_RETWEETS=\n\n# Bot language to skip RT of foreign tweets\nLANGUAGE=en\n\n# Bot log level: debug or info\nLOG_LEVEL=debug\n\n# Bot mode: rate || retweet\nMODE=retweet\n\n# Tweet rating scale: 1 to 10\nRATING_SCALE=3\n\n# Bot rate quoted tweet emojis\n# 🔥/🎉 | 😡/💫 | ◽ || 🔹|🔸|◽ - blue, orange and grey squares\nPOSITIVE_EMOJI=🔥\nNEGATIVE_EMOJI=😡\nNEUTRAL_EMOJI=◽\n\n# Adds matching hashtags to rate quoted tweets\nADD_HASHTAGS=\n\nSENTIMENT_TEST=my bot is not that bad\n\n# Twitter bot API keys\nCONSUMER_KEY=\nCONSUMER_SECRET=\nACCESS_TOKEN=\nACCESS_TOKEN_SECRET=\n\n# Add your Twitter bot API keys and copy this file to .env for local testing of your Twitter bot with node.js\n\n```\n\u003e Read Twitter automation ground rules before you proceed to running your own bot\nhttps://help.twitter.com/en/rules-and-policies/twitter-automation\n\nThe settings I've chosen for this Twitter bot limit the number of RT's your bot will send to comply with Twitter rules and rate limit regulations. Fine tune them at your own risk :(\n\n# Test\n\nBefore you run your new Twitter bot, please consider testing it first.\n\nChange log level to debug for this bot to skip the actual retweet or quoted tweet step and output matching tweets trace.\n\nin your .env bot config file change this line to debug:\n\n```\n# Bot log level\nLOG_LEVEL=debug\n```\n\nThis option is also handy to fine-tune mute tweet and user keywords config, and ban spam users by building a private 'blacklist' Twitter list to ignore marketing and spammy Twitter users and bots.\n\nOnce you are happy with the results change log level to info for this Twitter bot to start retweeting or generating quoted tweet rating tweets in 'rate' bot mode. See src/bot.js code for what is done in 'rate' bot mode. Modify as desired.\n\n# RT and Rate Twitter Bot Config\n\nFor an example of a hybrid rate quoted tweets and retweets with links see WebPackSense.env bot config, and the actual Twitter bot I created for the webpack dev community: https://twitter.com/WebPackSense\n\nand v3.0 of this bot for webdevs: https://twitter.com/WebDevCreations\n\nFrom the first fews days of testing and running @WebPackSense bot to collect good webpack reads and guage webdev's feedback on that framework:\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/WebPackSensePromo2017.png?raw=true \n \"@WebPackSense\")\n\nRate and RT bot log trace from the first 20 hours of day 1 on the job :)\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/WebPackSenseAlpha20hrsRunDay1Trace.png?raw=true \n \"@WebPackSense\")\n\nNOTE: \n\n- every . in that trace is a skipped tweet due to bot config rules. \n- | denotes a straight up retweet of a tweet with a link.\n- new followers get logged and sent our greeting DM.\n- tweets without links generate a quoted tweet with emojis sentiment rating :)\n\n# 1. Run realtime Twitter stream/filter bot (default)\n\n\u003enode src/stream\n\nsample trace output (old pic from week 1 of bot dev :(\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/CyberDashTrace7.png?raw=true \n \"trace\")\n\nNOTE: \n\n- every . in that trace denotes a matching tweet analyzed and skipped according to the bot config rules. See 'Dasher's' :) timeline for actual RT's: https://twitter.com/CyberDash\n- new followers get a greeting DM\n- bot 'blacklist' is updated every 15 minutes for currating that channel live as new tweets come in and you detect noise tweet sources\n- your friends, bots and tweeps you follow, are automatically added to the bot 'whitelist', which is updated every hour. tweets from friends on the subject keywords you configured don't require a link to be retweeted\n\nThere is probably more that this bot does that escapes my recollection after 2 weeks of coding and tweeking it for the 2 Twitter bot accounts I've set up. I suggest you review src/bot.js code and mod for your needs. That code is heavily documented and nicely formatted. Enjoy! Buy me a beer some day if you end up using this custom Twitter news bot code.\n\n# 2. OR Run search.js for periodic RT's\n\n\u003enode src/search\n\nsearch/tweets 'webpack' bot run trace sample:\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/WebPackSenseSearchTweetsRunTrace1.png?raw=true \n \"SearchTweetsTrace\")\n\n# Deploy your custom Twitter news bot to Heroku\n\nThe best way to put your custom Twitter news bot on auto-pilot is to deploy it to Heroku, and run it in a worker dyno, after initial local testing and config. Heroku worker dyno's are free to use for low volume feeds. \n\nHere is a sample log of my WebPackSense Twitter bot running on Heroku in a worker dyno configured to filter realtime tweets about webpack via stream.js:\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/WebPackSenseBotWorkerOnHeroku.png?raw=true \n \"workerLog\")\n\n![Alt text](https://github.com/RandomFractals/CyberDash/blob/master/screens/WebPackSenseWorkerProcessLog.png?raw=true \n \"workerLog2\")\n\n# v3.x TODO\n\n- Plug in smarter sentiments lib or service call for rating quoted tweets without links.\n- hook up redis and check for tweet duplicates from tweeps that post same articles every day for promo\n- add different match algo's?: contains, regex, or http://compromise.cool/\n- add followBack(user) to new user stream follower event to see what that looks like? Automate! :)\n\n# This Twitter Bot 3rd party API References\n\nhttps://github.com/motdotla/dotenv - used for bot config\n\nhttps://github.com/ttezel/twit - used for Twitter API calls\n\nhttps://github.com/log4js-node/log4js-node - used for bot info, debug and error logging\n\nhttps://github.com/thisandagain/sentiment - used for rate quoted tweets scoring for now\n\nhttps://github.com/nlp-compromise/compromise - used for normalizing tweet text prior to sentiment scoring\n\n# Twitter Dev Docs for Filter and Search Tweets APIs\n\nhttps://apps.twitter.com/ - go here first to create your Twitter bot app first\n\nhttps://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter.html\n\nhttps://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets.html\n\nhttps://developer.twitter.com/en/docs/tweets/search/guides/standard-operators\n\nhttps://apps.timwhitlock.info/emoji/tables/unicode - see these to change tweet rating emojis in your bot .env config\n\n# Twitter Bots Tutorials\n\nhttps://github.com/amandeepmittal/awesome-twitter-bots\n\nhttps://medium.freecodecamp.org/how-to-build-and-deploy-a-multifunctional-twitter-bot-49e941bb3092\n\n## Fun Twitter Bots on Github\n\nhttps://github.com/aershov24/ibotsunburn -\u003e https://twitter.com/ibotsunburn\n\nhttps://github.com/maeligg/JSLibGenerator -\u003e https://twitter.com/JSLibGenerator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomfractals%2Fcyberdash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandomfractals%2Fcyberdash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandomfractals%2Fcyberdash/lists"}