s3utils 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +19 -0
- data/README.md +50 -0
- data/bin/s3cmd +5 -0
- data/lib/s3utils.rb +126 -0
- data/lib/s3utils/version.rb +3 -0
- data/lib/text.txt +221 -0
- metadata +107 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2012 by Jasmeet Chhabra
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
s3utils
|
2
|
+
=======
|
3
|
+
|
4
|
+
Ruby s3 utils that use AWS SDK to work easily with IAM roles.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
-------------
|
8
|
+
|
9
|
+
gem install s3utils
|
10
|
+
|
11
|
+
Setting up gem
|
12
|
+
---------------
|
13
|
+
|
14
|
+
AWS configuration is taken from one of the following places in the order
|
15
|
+
given:
|
16
|
+
|
17
|
+
1. If Environment Variable AWS_CREDENTIAL_FILE is set, it will
|
18
|
+
look in the file. The file should have at least two lines:·
|
19
|
+
|
20
|
+
|
21
|
+
AWSAccessKeyId=A34554D...
|
22
|
+
|
23
|
+
AWSSecretKey=ACF4545666...
|
24
|
+
|
25
|
+
|
26
|
+
2. Environment Variables:
|
27
|
+
AWS_ACCESS_KEY_ID and
|
28
|
+
AWS_SECRET_ACCESS_KEY
|
29
|
+
|
30
|
+
3. If you are running this in an EC2 instance with IAM role, this will
|
31
|
+
automatically pick up the configuration
|
32
|
+
|
33
|
+
Proxy Settings
|
34
|
+
------------
|
35
|
+
|
36
|
+
If you are behind a proxy, set the environment variable:
|
37
|
+
HTTPS_PROXY_='https://user:password@my.proxy:443/'
|
38
|
+
|
39
|
+
Commands available after install
|
40
|
+
----------------------------
|
41
|
+
|
42
|
+
s3cmd createbucket name # creates a bucket
|
43
|
+
s3cmd deletebucket name # deletes a bucket, if it is empty
|
44
|
+
s3cmd deletekey bucket:key # deletes a key in the given bucket
|
45
|
+
s3cmd get bucket:key file # get the file for the key from the bucket
|
46
|
+
s3cmd get_timestamp bucket:key # get the last modified integer timestamp for the key from the bucket
|
47
|
+
s3cmd help [TASK] # Describe available tasks or one specific task
|
48
|
+
s3cmd list bucket:prefix # list the keys of a bucket
|
49
|
+
s3cmd listbuckets # lists all of the buckets in your account
|
50
|
+
s3cmd put bucket:key file # puts a file for the key in the bucket
|
data/bin/s3cmd
ADDED
data/lib/s3utils.rb
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'aws-sdk'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module S3Utils
|
6
|
+
require "s3utils/version"
|
7
|
+
|
8
|
+
class Main < Thor
|
9
|
+
desc "listbuckets", "lists all of the buckets in your account"
|
10
|
+
def listbuckets
|
11
|
+
with_error_handling do
|
12
|
+
s3.buckets.each do |bucket|
|
13
|
+
puts bucket.name
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "createbucket name", "creates a bucket"
|
20
|
+
def createbucket(name)
|
21
|
+
with_error_handling do
|
22
|
+
bucket = s3.buckets.create(name)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
desc "deletekey bucket:key", "deletes a key in the given bucket"
|
28
|
+
def deletekey(bucket_key)
|
29
|
+
with_error_handling do
|
30
|
+
abort "Error: incorrect bucket:key format" unless bucket_key =~ /(.+):(.+)/
|
31
|
+
s3.buckets[$1].objects[$2].delete
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "deletebucket name", "deletes a bucket, if it is empty"
|
36
|
+
def deletebucket(name)
|
37
|
+
with_error_handling do
|
38
|
+
s3.buckets[name].delete
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
desc "list bucket:prefix", "list the keys of a bucket"
|
44
|
+
def list(bucket_prefix)
|
45
|
+
with_error_handling do
|
46
|
+
if bucket_prefix =~ /(.+):(.+)/
|
47
|
+
objects = s3.buckets[$1].objects.with_prefix($2)
|
48
|
+
else
|
49
|
+
objects = s3.buckets[bucket_prefix].objects
|
50
|
+
end
|
51
|
+
objects.each do |o|
|
52
|
+
puts o.key
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "gettimestamp bucket:key", "get the last modified integer timestamp for the key from the bucket"
|
58
|
+
def get_timestamp(bucket_key)
|
59
|
+
with_error_handling do
|
60
|
+
abort "Error: incorrect bucket:key format" unless bucket_key =~ /(.+):(.+)/
|
61
|
+
o = s3.buckets[$1].objects[$2]
|
62
|
+
puts o.last_modified.to_i
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "get bucket:key file", "get the file for the key from the bucket"
|
67
|
+
def get(bucket_key, file)
|
68
|
+
with_error_handling do
|
69
|
+
abort "Error: incorrect bucket:key format" unless bucket_key =~ /(.+):(.+)/
|
70
|
+
o = s3.buckets[$1].objects[$2]
|
71
|
+
File.open(file, "w"){|f| f.write(o.read)}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
desc "put bucket:key file", "puts a file for the key in the bucket"
|
78
|
+
def put(bucket_key, file)
|
79
|
+
with_error_handling do
|
80
|
+
abort "Error: incorrect bucket:key format" unless bucket_key =~ /(.+):(.+)/
|
81
|
+
File.open(file, "r") { |f| s3.buckets[$1].objects.create($2, :data => f.read)}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def with_error_handling
|
87
|
+
begin
|
88
|
+
yield
|
89
|
+
rescue Exception => e
|
90
|
+
abort "Error: " + e.message
|
91
|
+
end
|
92
|
+
end
|
93
|
+
def s3
|
94
|
+
@s3 ||= begin
|
95
|
+
access_key, secret_key = nil, nil
|
96
|
+
|
97
|
+
if ENV["AWS_CREDENTIAL_FILE"]
|
98
|
+
File.open(ENV["AWS_CREDENTIAL_FILE"]) do |file|
|
99
|
+
file.lines.each do |line|
|
100
|
+
access_key = $1 if line =~ /^AWSAccessKeyId=(.*)$/
|
101
|
+
secret_key = $1 if line =~ /^AWSSecretKey=(.*)$/
|
102
|
+
end
|
103
|
+
end
|
104
|
+
elsif ENV["AWS_ACCESS_KEY"] || ENV["AWS_SECRET_KEY"]
|
105
|
+
access_key = ENV["AWS_ACCESS_KEY"]
|
106
|
+
secret_key = ENV["AWS_SECRET_KEY"]
|
107
|
+
end
|
108
|
+
|
109
|
+
opt = ENV["HTTPS_PROXY"] ? {:proxy_uri => ENV["HTTPS_PROXY"]} : {}
|
110
|
+
AWS.config({ :access_key_id => access_key,
|
111
|
+
:secret_access_key => secret_key}.merge opt)
|
112
|
+
begin
|
113
|
+
s3 = AWS::S3.new
|
114
|
+
#test connection by checking for 1 bucket name
|
115
|
+
s3.buckets.each do |bucket|
|
116
|
+
bucket.name
|
117
|
+
break
|
118
|
+
end
|
119
|
+
rescue Exception => e
|
120
|
+
abort "Error: " + e.message
|
121
|
+
end
|
122
|
+
s3
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
data/lib/text.txt
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
(function(){
|
2
|
+
function hex_md5(p) {
|
3
|
+
return binl2hex(core_md5(str2binl(p),p.length*8));
|
4
|
+
}
|
5
|
+
|
6
|
+
function core_md5(x,len){
|
7
|
+
x[len>>5]|=0x80<<((len)%32);
|
8
|
+
x[(((len+64)>>>9)<<4)+14]=len;
|
9
|
+
var a=1732584193;
|
10
|
+
var b=-271733879;
|
11
|
+
var c=-1732584194;
|
12
|
+
var d=271733878;
|
13
|
+
for(var i=0;i<x.length;i+=16){
|
14
|
+
var olda=a;
|
15
|
+
var oldb=b;
|
16
|
+
var oldc=c;
|
17
|
+
var oldd=d;
|
18
|
+
a=md5_ff(a,b,c,d,x[i+0],7,-680876936);
|
19
|
+
d=md5_ff(d,a,b,c,x[i+1],12,-389564586);
|
20
|
+
c=md5_ff(c,d,a,b,x[i+2],17,606105819);
|
21
|
+
b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);
|
22
|
+
a=md5_ff(a,b,c,d,x[i+4],7,-176418897);
|
23
|
+
d=md5_ff(d,a,b,c,x[i+5],12,1200080426);
|
24
|
+
c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);
|
25
|
+
b=md5_ff(b,c,d,a,x[i+7],22,-45705983);
|
26
|
+
a=md5_ff(a,b,c,d,x[i+8],7,1770035416);
|
27
|
+
d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);
|
28
|
+
c=md5_ff(c,d,a,b,x[i+10],17,-42063);
|
29
|
+
b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);
|
30
|
+
a=md5_ff(a,b,c,d,x[i+12],7,1804603682);
|
31
|
+
d=md5_ff(d,a,b,c,x[i+13],12,-40341101);
|
32
|
+
c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);
|
33
|
+
b=md5_ff(b,c,d,a,x[i+15],22,1236535329);
|
34
|
+
a=md5_gg(a,b,c,d,x[i+1],5,-165796510);
|
35
|
+
d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);
|
36
|
+
c=md5_gg(c,d,a,b,x[i+11],14,643717713);
|
37
|
+
b=md5_gg(b,c,d,a,x[i+0],20,-373897302);
|
38
|
+
a=md5_gg(a,b,c,d,x[i+5],5,-701558691);
|
39
|
+
d=md5_gg(d,a,b,c,x[i+10],9,38016083);
|
40
|
+
c=md5_gg(c,d,a,b,x[i+15],14,-660478335);
|
41
|
+
b=md5_gg(b,c,d,a,x[i+4],20,-405537848);
|
42
|
+
a=md5_gg(a,b,c,d,x[i+9],5,568446438);
|
43
|
+
d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);
|
44
|
+
c=md5_gg(c,d,a,b,x[i+3],14,-187363961);
|
45
|
+
b=md5_gg(b,c,d,a,x[i+8],20,1163531501);
|
46
|
+
a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);
|
47
|
+
d=md5_gg(d,a,b,c,x[i+2],9,-51403784);
|
48
|
+
c=md5_gg(c,d,a,b,x[i+7],14,1735328473);
|
49
|
+
b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);
|
50
|
+
a=md5_hh(a,b,c,d,x[i+5],4,-378558);
|
51
|
+
d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);
|
52
|
+
c=md5_hh(c,d,a,b,x[i+11],16,1839030562);
|
53
|
+
b=md5_hh(b,c,d,a,x[i+14],23,-35309556);
|
54
|
+
a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);
|
55
|
+
d=md5_hh(d,a,b,c,x[i+4],11,1272893353);
|
56
|
+
c=md5_hh(c,d,a,b,x[i+7],16,-155497632);
|
57
|
+
b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);
|
58
|
+
a=md5_hh(a,b,c,d,x[i+13],4,681279174);
|
59
|
+
d=md5_hh(d,a,b,c,x[i+0],11,-358537222);
|
60
|
+
c=md5_hh(c,d,a,b,x[i+3],16,-722521979);
|
61
|
+
b=md5_hh(b,c,d,a,x[i+6],23,76029189);
|
62
|
+
a=md5_hh(a,b,c,d,x[i+9],4,-640364487);
|
63
|
+
d=md5_hh(d,a,b,c,x[i+12],11,-421815835);
|
64
|
+
c=md5_hh(c,d,a,b,x[i+15],16,530742520);
|
65
|
+
b=md5_hh(b,c,d,a,x[i+2],23,-995338651);
|
66
|
+
a=md5_ii(a,b,c,d,x[i+0],6,-198630844);
|
67
|
+
d=md5_ii(d,a,b,c,x[i+7],10,1126891415);
|
68
|
+
c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);
|
69
|
+
b=md5_ii(b,c,d,a,x[i+5],21,-57434055);
|
70
|
+
a=md5_ii(a,b,c,d,x[i+12],6,1700485571);
|
71
|
+
d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);
|
72
|
+
c=md5_ii(c,d,a,b,x[i+10],15,-1051523);
|
73
|
+
b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);
|
74
|
+
a=md5_ii(a,b,c,d,x[i+8],6,1873313359);
|
75
|
+
d=md5_ii(d,a,b,c,x[i+15],10,-30611744);
|
76
|
+
c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);
|
77
|
+
b=md5_ii(b,c,d,a,x[i+13],21,1309151649);
|
78
|
+
a=md5_ii(a,b,c,d,x[i+4],6,-145523070);
|
79
|
+
d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);
|
80
|
+
c=md5_ii(c,d,a,b,x[i+2],15,718787259);
|
81
|
+
b=md5_ii(b,c,d,a,x[i+9],21,-343485551);
|
82
|
+
a=safe_add(a,olda);
|
83
|
+
b=safe_add(b,oldb);
|
84
|
+
c=safe_add(c,oldc);
|
85
|
+
d=safe_add(d,oldd);
|
86
|
+
}
|
87
|
+
return Array(a,b,c,d);
|
88
|
+
}
|
89
|
+
|
90
|
+
function md5_cmn(q,a,b,x,s,t) { return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b); }
|
91
|
+
function md5_ff(a,b,c,d,x,s,t) { return md5_cmn((b&c)|((~b)&d),a,b,x,s,t); }
|
92
|
+
function md5_gg(a,b,c,d,x,s,t) { return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t); }
|
93
|
+
function md5_hh(a,b,c,d,x,s,t) { return md5_cmn(b^c^d,a,b,x,s,t); }
|
94
|
+
function md5_ii(a,b,c,d,x,s,t) { return md5_cmn(c^(b|(~d)),a,b,x,s,t); }
|
95
|
+
|
96
|
+
function safe_add(x,y) {
|
97
|
+
var lsw=(x&0xFFFF)+(y&0xFFFF);
|
98
|
+
var msw=(x>>16)+(y>>16)+(lsw>>16);
|
99
|
+
return (msw<<16)|(lsw&0xFFFF);
|
100
|
+
}
|
101
|
+
|
102
|
+
function bit_rol(num,cnt) { return (num<<cnt)|(num>>>(32-cnt)); }
|
103
|
+
|
104
|
+
function str2binl(str) {
|
105
|
+
var bin=Array();
|
106
|
+
var mask=(1<<8)-1;
|
107
|
+
for(var i=0;i<str.length*8;i+=8) bin[i>>5]|=(str.charCodeAt(i/8)&mask)<<(i%32);
|
108
|
+
return bin;
|
109
|
+
}
|
110
|
+
|
111
|
+
function binl2hex(binarray) {
|
112
|
+
var hex_tab='0123456789abcdefABCDEF';
|
113
|
+
var str='';
|
114
|
+
var j=0;
|
115
|
+
for(var i=0;i<binarray.length*4;i++) {
|
116
|
+
x1=(binarray[i>>2]>>((i%4)*8+4))&0xF;
|
117
|
+
x2=(binarray[i>>2]>>((i%4)*8))&0xF;
|
118
|
+
if(x1>9){
|
119
|
+
j++;
|
120
|
+
if(j%2) x1=x1+6;
|
121
|
+
}
|
122
|
+
if(x2>9){
|
123
|
+
j++;
|
124
|
+
if(j%2) x2=x2+6;
|
125
|
+
}
|
126
|
+
str+=hex_tab.charAt(x1)+hex_tab.charAt(x2);
|
127
|
+
}
|
128
|
+
return str;
|
129
|
+
}
|
130
|
+
|
131
|
+
function genpass(pcapture,p,dpresent,plen,pcase,ppop) {
|
132
|
+
if(pcapture) {
|
133
|
+
var i=0,j=0,F=document.forms;
|
134
|
+
for(i=0;i<F.length;i++) {
|
135
|
+
E=F[i].elements;
|
136
|
+
for(j=0;j<E.length;j++) {
|
137
|
+
D=E[j];
|
138
|
+
if(D.type=='password') {
|
139
|
+
if(D.value) {
|
140
|
+
p=D.value;
|
141
|
+
alert('Using password found on page');
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
re=new RegExp("https*://([^/:]+)");
|
150
|
+
host=document.location.href.match(re)[1];
|
151
|
+
host=host.split('.');
|
152
|
+
if(host[2]!=null) {
|
153
|
+
s=host[host.length-2]+'.'+host[host.length-1];
|
154
|
+
domains='ab.ca|ac.ac|ac.at|ac.be|ac.cn|ac.il|ac.in|ac.jp|ac.kr|ac.nz|ac.th|ac.uk|ac.za|adm.br|adv.br|agro.pl|ah.cn|aid.pl|alt.za|am.br|arq.br|art.br|arts.ro|asn.au|asso.fr|asso.mc|atm.pl|auto.pl|bbs.tr|bc.ca|bio.br|biz.pl|bj.cn|br.com|cn.com|cng.br|cnt.br|co.ac|co.at|co.il|co.in|co.jp|co.kr|co.nz|co.th|co.uk|co.za|com.au|com.br|com.cn|com.ec|com.fr|com.hk|com.mm|com.mx|com.pl|com.ro|com.ru|com.sg|com.tr|com.tw|cq.cn|cri.nz|de.com|ecn.br|edu.au|edu.cn|edu.hk|edu.mm|edu.mx|edu.pl|edu.tr|edu.za|eng.br|ernet.in|esp.br|etc.br|eti.br|eu.com|eu.lv|fin.ec|firm.ro|fm.br|fot.br|fst.br|g12.br|gb.com|gb.net|gd.cn|gen.nz|gmina.pl|go.jp|go.kr|go.th|gob.mx|gov.br|gov.cn|gov.ec|gov.il|gov.in|gov.mm|gov.mx|gov.sg|gov.tr|gov.za|govt.nz|gs.cn|gsm.pl|gv.ac|gv.at|gx.cn|gz.cn|hb.cn|he.cn|hi.cn|hk.cn|hl.cn|hn.cn|hu.com|idv.tw|ind.br|inf.br|info.pl|info.ro|iwi.nz|jl.cn|jor.br|jpn.com|js.cn|k12.il|k12.tr|lel.br|ln.cn|ltd.uk|mail.pl|maori.nz|mb.ca|me.uk|med.br|med.ec|media.pl|mi.th|miasta.pl|mil.br|mil.ec|mil.nz|mil.pl|mil.tr|mil.za|mo.cn|muni.il|nb.ca|ne.jp|ne.kr|net.au|net.br|net.cn|net.ec|net.hk|net.il|net.in|net.mm|net.mx|net.nz|net.pl|net.ru|net.sg|net.th|net.tr|net.tw|net.za|nf.ca|ngo.za|nm.cn|nm.kr|no.com|nom.br|nom.pl|nom.ro|nom.za|ns.ca|nt.ca|nt.ro|ntr.br|nx.cn|odo.br|on.ca|or.ac|or.at|or.jp|or.kr|or.th|org.au|org.br|org.cn|org.ec|org.hk|org.il|org.mm|org.mx|org.nz|org.pl|org.ro|org.ru|org.sg|org.tr|org.tw|org.uk|org.za|pc.pl|pe.ca|plc.uk|ppg.br|presse.fr|priv.pl|pro.br|psc.br|psi.br|qc.ca|qc.com|qh.cn|re.kr|realestate.pl|rec.br|rec.ro|rel.pl|res.in|ru.com|sa.com|sc.cn|school.nz|school.za|se.com|se.net|sh.cn|shop.pl|sk.ca|sklep.pl|slg.br|sn.cn|sos.pl|store.ro|targi.pl|tj.cn|tm.fr|tm.mc|tm.pl|tm.ro|tm.za|tmp.br|tourism.pl|travel.pl|tur.br|turystyka.pl|tv.br|tw.cn|uk.co|uk.com|uk.net|us.com|uy.com|vet.br|web.za|web.com|www.ro|xj.cn|xz.cn|yk.ca|yn.cn|za.com';
|
155
|
+
domains=domains.split('|');
|
156
|
+
for(var i=0;i<domains.length;i++){
|
157
|
+
if(s==domains[i]){
|
158
|
+
s=host[host.length-3]+'.'+s;
|
159
|
+
break;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
} else {
|
163
|
+
s=host.join('.');
|
164
|
+
}
|
165
|
+
|
166
|
+
i=(dpresent)?'Master password:':'Master password for "'+s+'":';
|
167
|
+
p=(!p)?prompt(i,''):unescape(p);
|
168
|
+
|
169
|
+
if(p) {
|
170
|
+
if(dpresent) s=prompt('Using domain:',s).replace(/^\s*|\s*$/g,'');
|
171
|
+
|
172
|
+
if(s) {
|
173
|
+
if(!plen) {
|
174
|
+
plen='8';
|
175
|
+
plen=prompt('Generated password length:',plen);
|
176
|
+
if(plen.search(/^\d+$/)||plen<1||plen>32) {
|
177
|
+
if(plen>32) {
|
178
|
+
plen=32;
|
179
|
+
alert('Password length cannot exceed '+plen+'; using maximum value of '+plen+'.');
|
180
|
+
} else {
|
181
|
+
plen=8;
|
182
|
+
alert('Password length supplied is not a valid integer; using default of '+plen+'.');
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
p=hex_md5(p+':'+s).substr(0,plen);
|
188
|
+
|
189
|
+
if(!pcase) p=p.toLowerCase();
|
190
|
+
if(pcase==1) p=p.toUpperCase();
|
191
|
+
|
192
|
+
var not_found=true;
|
193
|
+
s='Generated password:';
|
194
|
+
if(!ppop) {
|
195
|
+
var i=0,j=0,F=document.forms;
|
196
|
+
s='No obvious password field detected; the \ngenerated password is:';
|
197
|
+
for(i=0;i<F.length;i++) {
|
198
|
+
E=F[i].elements;
|
199
|
+
for(j=0;j<E.length;j++) {
|
200
|
+
D=E[j];
|
201
|
+
if(D.type=='password') {
|
202
|
+
D.value=p;
|
203
|
+
D.focus();
|
204
|
+
not_found=false;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
}
|
209
|
+
if(not_found) prompt(s,p);
|
210
|
+
} else {
|
211
|
+
alert('Domain empty; cannot proceed.');
|
212
|
+
}
|
213
|
+
} else {
|
214
|
+
alert('Password empty; cannot proceed.');
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
var vals=document.getElementById('fs').src.split('#')[1].split(',');
|
219
|
+
for(i=0;i<vals.length;i++) if(vals[i]=='0') vals[i]=0;
|
220
|
+
genpass(vals[0],vals[1],vals[2],vals[3],vals[4],vals[5]);
|
221
|
+
})();
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: s3utils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jasmeet Chhabra
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-08-07 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: aws-sdk
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 15
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 6
|
32
|
+
- 0
|
33
|
+
version: 1.6.0
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: thor
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 43
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
- 15
|
48
|
+
- 4
|
49
|
+
version: 0.15.4
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
description: |
|
53
|
+
Provides a s3cmd binary to perform simple commands on buckets and objects in s3.
|
54
|
+
See https://github.com/jasmeetc/s3utils for more.
|
55
|
+
|
56
|
+
email:
|
57
|
+
- jasmeet@chhabra-inc.com
|
58
|
+
executables:
|
59
|
+
- s3cmd
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files: []
|
63
|
+
|
64
|
+
files:
|
65
|
+
- bin/s3cmd
|
66
|
+
- lib/s3utils/version.rb
|
67
|
+
- lib/s3utils.rb
|
68
|
+
- lib/text.txt
|
69
|
+
- LICENSE
|
70
|
+
- README.md
|
71
|
+
homepage: https://github.com/jasmeetc/s3utils
|
72
|
+
licenses: []
|
73
|
+
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 57
|
85
|
+
segments:
|
86
|
+
- 1
|
87
|
+
- 8
|
88
|
+
- 7
|
89
|
+
version: 1.8.7
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
hash: 3
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
version: "0"
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.8.24
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Simple tool for working with S3. Similar to s3cmd that comes with s3sync
|
106
|
+
test_files: []
|
107
|
+
|