Skip to content

Instantly share code, notes, and snippets.

@hahwul
Last active May 23, 2022 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hahwul/a34ac78e5a3f31f0850ef5fbf84b4299 to your computer and use it in GitHub Desktop.
Save hahwul/a34ac78e5a3f31f0850ef5fbf84b4299 to your computer and use it in GitHub Desktop.
searchGithubAtions
require "selenium-webdriver"
require "logger"
def searchCode code, logger
begin
options = Selenium::WebDriver::Firefox::Options.new
options.add_argument('--headless')
driver = Selenium::WebDriver.for :firefox , capabilities: options
driver.navigate.to "https://grep.app/search?q=#{code}&filter[lang][0]=YAML&filter[repo.pattern][0]=action"
sleep(3)
driver.find_elements(:class, "sui-result").each do |e|
logger.info "hit => #{e}"
end
rescue => e
logger.warn e
end
end
logger = Logger.new(STDERR)
logger.info "start"
searchCode ARGV[0], logger
logger.info "finish"
@hahwul
Copy link
Author

hahwul commented May 23, 2022

Log

$ ruby searchGithubAtions.rb "name: 'XSS Scan with Dalfox'"
I, [2022-05-24T00:18:28.845711 #49755]  INFO -- : start
I, [2022-05-24T00:18:37.189637 #49755]  INFO -- : hit => #<Selenium::WebDriver::Element:0x00007fd1e6966b20>
I, [2022-05-24T00:18:37.189691 #49755]  INFO -- : finish
$ ruby searchGithubAtions.rb "Upload a Build Artifact"
I, [2022-05-24T00:24:38.842715 #49901]  INFO -- : start
I, [2022-05-24T00:24:47.797441 #49901]  INFO -- : hit => #<Selenium::WebDriver::Element:0x00007fd36a9da658>
I, [2022-05-24T00:24:47.797502 #49901]  INFO -- : hit => #<Selenium::WebDriver::Element:0x00007fd36a9da630>
I, [2022-05-24T00:24:47.797519 #49901]  INFO -- : hit => #<Selenium::WebDriver::Element:0x00007fd36a9da608>
I, [2022-05-24T00:24:47.797535 #49901]  INFO -- : finish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment