Advertisement
Guest User

Untitled

a guest
May 11th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. ### My ruby code:
  2.  
  3. require 'pp'
  4. require 'censys'
  5. require 'pry'
  6.  
  7. api = CenSys::API.new
  8. ipresponse = api.ipv4.search(query: 'dropbox.com')
  9. ipresponse.each_page do |page|
  10. puts ">>> Page ##{page.metadata.page} / #{page.metadata.pages} ..."
  11.  
  12. page.each do |result|
  13. puts result
  14. end
  15. end
  16.  
  17. ### My Goal
  18.  
  19. I want this code to print the following
  20.  
  21. "IP Address: <IP> Ports: <port/proto>"
  22.  
  23. ### The Data
  24.  
  25. ipresponse = #<CenSys::Search::Response:0x00000004b17340
  26. @api=
  27. #<CenSys::API:0x00000004afbbe0
  28. @certificates=
  29. #<CenSys::API::Resource:0x00000004afba50
  30. #<CenSys::API::Resource:0x00000004afba50
  31. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  32. @type=:certificates>,
  33. @id="1f02fd16-393d-47e1-93d2-5a7df893ec9f",
  34. @ipv4=
  35. #<CenSys::API::Resource:0x00000004afbaa0
  36. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  37. @type=:ipv4>,
  38. @secret="Igf4RCRdUNloYX5Sii47jCv3fyf7owhw",
  39. @websites=
  40. #<CenSys::API::Resource:0x00000004afba78
  41. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  42. @type=:websites>>,
  43. @metadata=
  44. #<CenSys::Search::Metadata:0x00000004b17318
  45. @backend_time=19,
  46. @count=914,
  47. @page=1,
  48. @pages=10,
  49. @query="dropbox.com">,
  50. @params={:query=>"dropbox.com"},
  51. @result_type=:ipv4,
  52. @results=
  53. [#<CenSys::Search::IPv4:0x00000004b172c8
  54. @api=
  55. #<CenSys::API:0x00000004afbbe0
  56. @certificates=
  57. #<CenSys::API::Resource:0x00000004afba50
  58. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  59. @type=:certificates>,
  60. @id="1f02fd16-393d-47e1-93d2-5a7df893ec9f",
  61. @ipv4=
  62. #<CenSys::API::Resource:0x00000004afbaa0
  63. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  64. @type=:ipv4>,
  65. @secret="Igf4RCRdUNloYX5Sii47jCv3fyf7owhw",
  66. @websites=
  67. #<CenSys::API::Resource:0x00000004afba78
  68. @api=#<CenSys::API:0x00000004afbbe0 ...>,
  69. @type=:websites>>,
  70. @attributes={"ip"=>"108.160.172.205", "protocols"=>["443/https"]}>,
  71. .
  72. .
  73. .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement