pwsqr 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :production do
4
+ gem "clipboard"
5
+ gem "clamp"
6
+ gem "onetime"
7
+ gem "qrcli"
8
+ gem "pws"
9
+ end
10
+
11
+ group :development do
12
+ gem "shoulda", ">= 0"
13
+ gem "rdoc", "~> 3.12"
14
+ gem "bundler", "> 1.0.0"
15
+ gem "jeweler", "~> 1.8.4"
16
+ gem "simplecov", ">= 0"
17
+ gem "rcov"
18
+ gem "awesome_print"
19
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.9)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ awesome_print (1.1.0)
8
+ clamp (0.5.0)
9
+ clipboard (1.0.1)
10
+ drydock (0.6.9)
11
+ git (1.2.5)
12
+ httparty (0.9.0)
13
+ multi_json (~> 1.0)
14
+ multi_xml
15
+ i18n (0.6.1)
16
+ jeweler (1.8.4)
17
+ bundler (~> 1.0)
18
+ git (>= 1.2.5)
19
+ rake
20
+ rdoc
21
+ json (1.7.5)
22
+ multi_json (1.3.7)
23
+ multi_xml (0.5.1)
24
+ onetime (0.4.0)
25
+ drydock (>= 0.6.9)
26
+ httparty (>= 0.7.7)
27
+ json (>= 1.6.4)
28
+ paint (0.8.5)
29
+ pbkdf2 (0.1.0)
30
+ pws (1.0.4)
31
+ clipboard (~> 1.0.1)
32
+ paint (>= 0.8.4)
33
+ pbkdf2
34
+ zucker (>= 12.1)
35
+ qrcli (0.0.1)
36
+ rqrcode
37
+ rake (10.0.1)
38
+ rcov (0.9.11)
39
+ rdoc (3.12)
40
+ json (~> 1.4)
41
+ rqrcode (0.4.2)
42
+ shoulda (3.3.2)
43
+ shoulda-context (~> 1.0.1)
44
+ shoulda-matchers (~> 1.4.1)
45
+ shoulda-context (1.0.1)
46
+ shoulda-matchers (1.4.1)
47
+ activesupport (>= 3.0.0)
48
+ simplecov (0.7.1)
49
+ multi_json (~> 1.0)
50
+ simplecov-html (~> 0.7.1)
51
+ simplecov-html (0.7.1)
52
+ zucker (12.1)
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ awesome_print
59
+ bundler (> 1.0.0)
60
+ clamp
61
+ clipboard
62
+ jeweler (~> 1.8.4)
63
+ onetime
64
+ pws
65
+ qrcli
66
+ rcov
67
+ rdoc (~> 3.12)
68
+ shoulda
69
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Smile @rT
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,27 @@
1
+ = pwsqr
2
+
3
+ This gem helps you securely and easily copy passwords from terminal pws tool, to your mobile devices using QR codes.
4
+
5
+ PWS gem (https://github.com/janlelis/pws) is required to use this tool and will be installed as dependency if you doesn't has one already.
6
+
7
+ By default pwsqr works offline and trying to use onetimesecret.com service to store your password privately behind QR code with short URL.
8
+ To use this feature, run pwsqr with '$ pwsqr init' command first and setup your email and API key in newly generated config
9
+ file in your $HOME directory: ~/.pwsqr
10
+
11
+ For more options run '$ pwsqr --help' command.
12
+
13
+ == Contributing to pwsqr
14
+
15
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
16
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
17
+ * Fork the project.
18
+ * Start a feature/bugfix branch.
19
+ * Commit and push until you are happy with your contribution.
20
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
+
23
+ == Copyright
24
+
25
+ Copyright (c) 2012 Smile @rT. See LICENSE.txt for
26
+ further details.
27
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "pwsqr"
18
+ gem.homepage = "http://github.com/smileart/pwsqr"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Simple QR interface to pws gem, to easily use your passwords on a smartphone!}
21
+ gem.description = %Q{This gem helps you securely and easily copy passwords from terminal pws tool, to your mobile devices using QR codes.}
22
+ gem.email = "smileart21@gmail.com"
23
+ gem.authors = ["Smile @rT"]
24
+ gem.executables = ["pwsqr"]
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rake/testtask'
30
+ Rake::TestTask.new(:test) do |test|
31
+ test.libs << 'lib' << 'test'
32
+ test.pattern = 'test/**/test_*.rb'
33
+ test.verbose = true
34
+ end
35
+
36
+ require 'rcov/rcovtask'
37
+ Rcov::RcovTask.new do |test|
38
+ test.libs << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ test.rcov_opts << '--exclude "gems/*"'
42
+ end
43
+
44
+ task :default => :test
45
+
46
+ require 'rdoc/task'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "pwsqr #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/pwsqr ADDED
@@ -0,0 +1,84 @@
1
+ #! /usr/bin/env ruby
2
+ #! coding = utf-8
3
+
4
+ require 'clamp'
5
+ require 'clipboard'
6
+ require 'optimism'
7
+ require 'awesome_print'
8
+ require 'yaml'
9
+
10
+
11
+ class PwsQrCommand < Clamp::Command
12
+
13
+ parameter "key", "the key password sotred on"
14
+ option ["--offline", "--local", "-o"], :flag, "force local password usage (disable onetimesecret if configured)\n" +
15
+ "WARNING: be careful using this option and remember to reset your terminal output history"
16
+ option ["-e", "--email"], :flag, "generates onetimesecret URL and also send it to your account"
17
+ option ["-n", "--namespace"], "NAMESPACE", "selects pws namespace to get password from it"
18
+
19
+ PATH = ENV['HOME']+"/.pwsqr"
20
+
21
+ if(File.exists?(PATH))
22
+ CONFIG = YAML.load_file(PATH) unless defined? CONFIG
23
+ else
24
+ config = {onetime:{email:'', api_key:''}, url_shortening:{url:'http://clck.ru/--?url='}}
25
+
26
+ File.open(PATH, "w") do |f|
27
+ f.write(config.to_yaml)
28
+ end
29
+
30
+ if ARGV[0] == 'init'
31
+ puts " pwsqr config generated in your home folder: #{PATH}\n"
32
+ puts " In order to use pwsqr online, please create your account here https://onetimesecret.com/signup\n"
33
+ puts " end setup your settings in that config file. Thanks! ◕ ◡ ◕ \n"
34
+ exit
35
+ end
36
+ end
37
+
38
+ self.description = %{
39
+ ======================================================
40
+ Command line QR tool for PWS gem…
41
+ ======================================================
42
+ }
43
+
44
+ def execute
45
+
46
+ if(!namespace.nil?)
47
+ ns = " -#{namespace} "
48
+ else
49
+ ns = " "
50
+ end
51
+
52
+ backup = Clipboard.paste
53
+
54
+ if(system("pws#{ns}get #{key} 0"))
55
+ if(defined?(CONFIG) && !CONFIG[:onetime][:email].empty? && !offline?)
56
+ require 'open-uri'
57
+ require 'onetime/api'
58
+
59
+ api = Onetime::API.new CONFIG[:onetime][:email], CONFIG[:onetime][:api_key]
60
+
61
+ options = {
62
+ :secret => Clipboard.paste,
63
+ :ttl => 7200
64
+ }
65
+
66
+ options[:recipient] = CONFIG[:onetime][:email] if email?
67
+
68
+ secret = api.post '/share', options
69
+ url = 'https://onetimesecret.com/secret/' + secret['secret_key']
70
+
71
+ short_url = open(CONFIG[:url_shortening][:url]+url).read
72
+ system("qrcli #{short_url}")
73
+ else
74
+ require 'open3'
75
+ Open3.popen3("qrcli", Clipboard.paste) { |i, o| puts o.read }
76
+ end
77
+
78
+ Clipboard.copy(backup)
79
+ end
80
+
81
+ end
82
+ end
83
+
84
+ PwsQrCommand.run
data/lib/pwsqr.rb ADDED
File without changes
data/pwsqr.gemspec ADDED
@@ -0,0 +1,70 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "pwsqr"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Smile @rT"]
12
+ s.date = "2012-11-18"
13
+ s.description = "This gem helps you securely and easily copy passwords from terminal pws tool, to your mobile devices using QR codes."
14
+ s.email = "smileart21@gmail.com"
15
+ s.executables = ["pwsqr"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/pwsqr",
29
+ "lib/pwsqr.rb",
30
+ "pwsqr.gemspec",
31
+ "test/helper.rb",
32
+ "test/test_pwsqr.rb"
33
+ ]
34
+ s.homepage = "http://github.com/smileart/pwsqr"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.24"
38
+ s.summary = "Simple QR interface to pws gem, to easily use your passwords on a smartphone!"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
45
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
46
+ s.add_development_dependency(%q<bundler>, ["> 1.0.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
48
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
49
+ s.add_development_dependency(%q<rcov>, [">= 0"])
50
+ s.add_development_dependency(%q<awesome_print>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<shoulda>, [">= 0"])
53
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
56
+ s.add_dependency(%q<simplecov>, [">= 0"])
57
+ s.add_dependency(%q<rcov>, [">= 0"])
58
+ s.add_dependency(%q<awesome_print>, [">= 0"])
59
+ end
60
+ else
61
+ s.add_dependency(%q<shoulda>, [">= 0"])
62
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
63
+ s.add_dependency(%q<bundler>, ["> 1.0.0"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
65
+ s.add_dependency(%q<simplecov>, [">= 0"])
66
+ s.add_dependency(%q<rcov>, [">= 0"])
67
+ s.add_dependency(%q<awesome_print>, [">= 0"])
68
+ end
69
+ end
70
+
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'pwsqr'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestPwsqr < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pwsqr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Smile @rT
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.12'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.12'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>'
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>'
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.4
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.4
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rcov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: awesome_print
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: This gem helps you securely and easily copy passwords from terminal pws
127
+ tool, to your mobile devices using QR codes.
128
+ email: smileart21@gmail.com
129
+ executables:
130
+ - pwsqr
131
+ extensions: []
132
+ extra_rdoc_files:
133
+ - LICENSE.txt
134
+ - README.rdoc
135
+ files:
136
+ - .document
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE.txt
140
+ - README.rdoc
141
+ - Rakefile
142
+ - VERSION
143
+ - bin/pwsqr
144
+ - lib/pwsqr.rb
145
+ - pwsqr.gemspec
146
+ - test/helper.rb
147
+ - test/test_pwsqr.rb
148
+ homepage: http://github.com/smileart/pwsqr
149
+ licenses:
150
+ - MIT
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ segments:
162
+ - 0
163
+ hash: -4065452259173910976
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ! '>='
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ requirements: []
171
+ rubyforge_project:
172
+ rubygems_version: 1.8.24
173
+ signing_key:
174
+ specification_version: 3
175
+ summary: Simple QR interface to pws gem, to easily use your passwords on a smartphone!
176
+ test_files: []