efreesms 0.0.1 → 0.0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sms +11 -0
- data/lib/efreesms.rb +23 -14
- data/lib/efreesms/bin.rb +14 -2
- data/lib/efreesms/version.rb +13 -1
- metadata +2 -1
data/bin/sms
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
4
|
+
# Version 2, December 2004
|
5
|
+
#
|
6
|
+
# Copyleft shura [shura1991@gmail.com]
|
7
|
+
#
|
8
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
9
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
10
|
+
#
|
11
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
12
|
+
#++
|
2
13
|
|
3
14
|
require 'efreesms/bin'
|
4
15
|
|
data/lib/efreesms.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
#--
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Copyleft shura [shura1991@gmail.com]
|
6
|
+
#
|
7
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
8
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
9
|
+
#
|
10
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
11
|
+
#++
|
12
|
+
|
1
13
|
require 'RMagick'
|
2
14
|
require 'tempfile'
|
3
15
|
require 'nokogiri'
|
@@ -16,21 +28,19 @@ class EFreeSMS
|
|
16
28
|
end
|
17
29
|
|
18
30
|
def self.resolve (browser)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
''.tap {|res|
|
32
|
+
Dir.mktmpdir {|d|
|
33
|
+
Dir.chdir(d) {|d|
|
34
|
+
download(browser, File.join(File.realpath(d), 'captcha.jpg'))
|
35
|
+
Magick::Image.read('captcha.jpg')[0].resize(130, 50).negate.despeckle.write('captcha.tif')
|
36
|
+
system('tesseract', 'captcha.tif', 'captcha', 2 => '/dev/null')
|
37
|
+
res.replace File.read('captcha.txt').strip
|
38
|
+
%w{captcha.jpg captcha.tif captcha.txt}.each {|f|
|
39
|
+
File.unlink(f)
|
40
|
+
}
|
29
41
|
}
|
30
42
|
}
|
31
43
|
}
|
32
|
-
|
33
|
-
return res
|
34
44
|
end
|
35
45
|
end
|
36
46
|
|
@@ -69,8 +79,7 @@ class EFreeSMS
|
|
69
79
|
'text' => text,
|
70
80
|
'vercode' => EFreeSMS::Captcha.resolve(browser),
|
71
81
|
'submit' => 'SEND SMS'
|
72
|
-
},
|
73
|
-
{
|
82
|
+
}, {
|
74
83
|
'Referer' => 'http://www.e-freesms.com/sms.php'
|
75
84
|
}).body
|
76
85
|
|
data/lib/efreesms/bin.rb
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
#--
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Copyleft shura [shura1991@gmail.com]
|
6
|
+
#
|
7
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
8
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
9
|
+
#
|
10
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
11
|
+
#++
|
12
|
+
|
1
13
|
require 'optparse'
|
2
14
|
require 'singleton'
|
3
15
|
require 'shellwords'
|
@@ -12,7 +24,7 @@ class EFreeSMS
|
|
12
24
|
reset
|
13
25
|
parse_opts
|
14
26
|
|
15
|
-
unless @editor and @country and @number
|
27
|
+
unless @user and @editor and @country and @number
|
16
28
|
$stderr.puts "Please, set up the client"
|
17
29
|
exit 1
|
18
30
|
end
|
@@ -59,7 +71,7 @@ class EFreeSMS
|
|
59
71
|
|
60
72
|
def edit
|
61
73
|
editor = Shellwords.shellwords(@editor)
|
62
|
-
file = Tempfile.new(['sms', 'txt']).tap {|x| x.close }.path
|
74
|
+
file = Tempfile.new(['sms', '.txt']).tap {|x| x.close }.path
|
63
75
|
Exec.system(*editor, file)
|
64
76
|
|
65
77
|
File.read(file).tap {
|
data/lib/efreesms/version.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
+
#--
|
2
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
3
|
+
# Version 2, December 2004
|
4
|
+
#
|
5
|
+
# Copyleft shura [shura1991@gmail.com]
|
6
|
+
#
|
7
|
+
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
8
|
+
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
9
|
+
#
|
10
|
+
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
11
|
+
#++
|
12
|
+
|
1
13
|
class EFreeSMS
|
2
14
|
USERAGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20100101 Firefox/6.0'
|
3
|
-
VERSION = '0.0.1'
|
15
|
+
VERSION = '0.0.1.1'
|
4
16
|
end
|