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 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
 
@@ -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
- res = ''
20
-
21
- Dir.mktmpdir {|d|
22
- Dir.chdir(d) {|d|
23
- download(browser, File.join(File.realpath(d), 'captcha.jpg'))
24
- Magick::Image.read('captcha.jpg')[0].resize(130, 50).negate.despeckle.write('captcha.tif')
25
- system('tesseract', 'captcha.tif', 'captcha', 2 => '/dev/null')
26
- res = File.read('captcha.txt').strip
27
- %w{captcha.jpg captcha.tif captcha.txt}.each {|f|
28
- File.unlink(f)
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
 
@@ -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 {
@@ -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
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 1
9
- version: 0.0.1
9
+ - 1
10
+ version: 0.0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - shura