zoomeye 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/README.md +57 -21
- data/lib/zoomeye/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74c39663cbf9404a62405becb0ede9ee827278c9
|
4
|
+
data.tar.gz: bf60a8d999c5bf0eea093cbad5fd255031e62ed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d710cc6e7ea02c4995bf9bb59fc654e8def36f61acb6039c50d151524ab030ab394df2bcd71133165a74e60ec887f5858ae830338ededa7b6f600b4513123416
|
7
|
+
data.tar.gz: c9b479108b12c22cc51cf3e740a29d9e935cb7e25dba8474914e7727c2656d1a04f5a206d4aa3a3149ada3339ba427373ba1b5aed0a664323370d89f249a6299
|
data/README.md
CHANGED
@@ -1,41 +1,77 @@
|
|
1
|
-
#
|
1
|
+
# rb_zoomeye
|
2
2
|
|
3
|
-
|
3
|
+
zoomeye api for ruby.
|
4
4
|
|
5
|
-
|
5
|
+
## Install
|
6
|
+
``` bash
|
7
|
+
gem install zoomeye
|
8
|
+
```
|
6
9
|
|
7
|
-
##
|
10
|
+
## Reference
|
8
11
|
|
9
|
-
|
12
|
+
As the official website, the interfaces provided encapsulation are below:
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
+ login
|
15
|
+
|
16
|
+
login with username and password, get an access token. for the details, please read the official api doc:
|
17
|
+
[https://www.zoomeye.org/api/doc#user](https://www.zoomeye.org/api/doc#user)
|
18
|
+
|
19
|
+
+ resouces_info
|
14
20
|
|
15
|
-
|
21
|
+
get resources info for account. for the details, please read the official api doc:
|
16
22
|
|
17
|
-
|
23
|
+
[https://www.zoomeye.org/api/doc#resources-info](https://www.zoomeye.org/api/doc#resources-info)
|
18
24
|
|
19
|
-
|
25
|
+
+ host_search
|
20
26
|
|
21
|
-
|
27
|
+
search the host devices. for the details, please read the official api doc:
|
22
28
|
|
23
|
-
|
29
|
+
[https://www.zoomeye.org/api/doc#host-search](https://www.zoomeye.org/api/doc#host-search)
|
24
30
|
|
25
|
-
TODO: Write usage instructions here
|
26
31
|
|
27
|
-
|
32
|
+
+ web_search
|
28
33
|
|
29
|
-
|
34
|
+
search the web technologies. for the details, please read the official api doc:
|
30
35
|
|
31
|
-
|
36
|
+
[https://www.zoomeye.org/api/doc#web-search] (https://www.zoomeye.org/api/doc#web-search)
|
32
37
|
|
33
|
-
|
38
|
+
**normally, a dict type is returned when call all above apis, except the 'login' api.**
|
34
39
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/zoomeye. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
40
|
|
41
|
+
## 异常捕获
|
37
42
|
|
38
|
-
|
43
|
+
``` ruby
|
44
|
+
class ZoomEyeError < StandardError
|
45
|
+
attr_reader :code, :desc
|
46
|
+
def initialize(code, desc)
|
47
|
+
@code = code # string: http status code
|
48
|
+
@desc = desc # string: http message
|
49
|
+
end
|
39
50
|
|
40
|
-
|
51
|
+
# return exceptial mesesage.
|
52
|
+
def message
|
53
|
+
"[#{@code}]#{@desc}"
|
54
|
+
end
|
55
|
+
end
|
41
56
|
|
57
|
+
```
|
58
|
+
|
59
|
+
## Example
|
60
|
+
|
61
|
+
``` ruby
|
62
|
+
#!/usr/bin/ruby -w
|
63
|
+
# -*- coding: utf-8 -*-
|
64
|
+
require File.dirname(__FILE__) + '/../zoom_eye.rb'
|
65
|
+
|
66
|
+
if __FILE__ == $0
|
67
|
+
begin
|
68
|
+
ze = ZoomEye.new(("foo@bar.com", "foopass")
|
69
|
+
ze.login
|
70
|
+
puts ze.resources
|
71
|
+
puts ze.host_search("port:80", 7, "app,device")
|
72
|
+
puts ze.web_search("port:21", 1, "webapp,os")
|
73
|
+
rescue => e
|
74
|
+
puts e.message
|
75
|
+
end
|
76
|
+
end
|
77
|
+
```
|
data/lib/zoomeye/version.rb
CHANGED