This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'mechanize' | |
| require 'fastercsv' | |
| def get_all_option_values(page, attr_name) | |
| page.search("[name=#{attr_name}]").search("option").map do |opt| | |
| option_value = opt.attribute("value").value | |
| [option_value, opt.text.strip.gsub(/\302\240\302\240/, '')] if option_value && option_value.length > 0 | |
| end.compact | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ftplib | |
| from ftplib import FTP | |
| buffer = '\x41' * 400 | |
| try: | |
| ftp = FTP('127.0.0.1') | |
| ftp.login(user, password) | |
| ftp.transfercmd("command" + buffer) | |
| print 'xxx' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main | |
| # urls is a hash containing url to retrieve statuses of items | |
| get_csv(urls, items) { |response, item| | |
| item_results = CSV.parse_line(response.body) | |
| item.setStatus(item_results[0]) | |
| } | |
| end | |
| def process_response(urls, items) |
NewerOlder