Skip to content

Instantly share code, notes, and snippets.

@ringowang
Created March 30, 2018 17:10
Show Gist options
  • Save ringowang/a8c9bdf81857b8404dccb7c4e7ebe828 to your computer and use it in GitHub Desktop.
Save ringowang/a8c9bdf81857b8404dccb7c4e7ebe828 to your computer and use it in GitHub Desktop.
cybereits
require 'net/http'
require 'active_record'
url = "https://df.cybereits.com/http/activities/create_temp"
uri = URI.parse(url)
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => 'example.db'
)
ActiveRecord::Schema.define do
unless ActiveRecord::Base.connection.tables.include? 'users'
create_table :users do |table|
table.column :eth_public_key, :string
table.column :eth_private_key, :string
table.column :code, :string
table.column :amount, :float
end
end
end
class User < ActiveRecord::Base
end
eth_reg = /\"address\":\"(.*)\",\"privKey\":\"(.*)\"}/
code_reg = /"code\":\"(.*)\",\"amount\":(.*),\"actived/
File.open('eth_addr.txt', 'r') do |file|
file.each_line.with_index do |line, index|
m = eth_reg.match(line)
params = {"eth_address": m[1], "invite_code": "A32EBA4080"}
res = Net::HTTP.post_form(uri, params)
n = code_reg.match(res.body)
User.create(eth_public_key: m[1], eth_private_key: m[2], code: "/A"+"#{n[1]}", amount: n[2].to_f)
p "第#{index+1}个搞定!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment