This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 15th, 2011  |  syntax: Ruby  |  size: 6.50 KB  |  views: 192  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # fuckPsn 0.3 (c) drizzt <drizzt@ibeglab.org>
  2.  
  3. require 'socket'
  4. require 'openssl'
  5.  
  6. $remoteHost = "199.108.4.73"
  7.  
  8. $remotePort = 443
  9.  
  10. puts "fuckPSN v0.3 by drizzt <drizzt@ibeglab.org>"
  11. puts "target address: #{$remoteHost}:#{$remotePort}"
  12.  
  13. localHost = "0.0.0.0"
  14. localPort = 443
  15.  
  16. $blockSize = 1024
  17.  
  18. cert_str = "-----BEGIN CERTIFICATE-----
  19. MIICqjCCAhOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJJVDER
  20. MA8GA1UECAwIVGVycm9uaWExITAfBgNVBAoMGFRoZSBCZXN0IENBIGluIHRoZSB3
  21. b3JsZDEcMBoGA1UEAwwTc3V4LnBsYXlzdGF0aW9uLm5ldDAeFw0xMTAyMTIxMjIx
  22. MDNaFw0xMjAyMTIxMjIxMDNaMFgxCzAJBgNVBAYTAklUMREwDwYDVQQIDAhUZXJy
  23. b25pYTERMA8GA1UECgwIU3RlYWwgbWUxIzAhBgNVBAMMGmF1dGgubnAuYWMucGxh
  24. eXN0YXRpb24ubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDeaCWUD+YV
  25. CMt8SelBscJndsib6Xhzd3kDP4lHydkCiIvoVq5YLMmKPkAH5WFCVJUMIDzkwFLX
  26. EIb897hrFcP44eejcS22TP3I4PfQfTMcHBJjyzbbPkrL84Uhnwm7w8Tr2QbKzEie
  27. YXDRrUDJKPvLS7pI3pircYIhpNNh9JKZOQIDAQABo3sweTAJBgNVHRMEAjAAMCwG
  28. CWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNV
  29. HQ4EFgQUTrI+noNYNyq6SW9tPiOMwW0qcOUwHwYDVR0jBBgwFoAU3F6SP7pK/OXO
  30. WPBZOluGVUb4EOcwDQYJKoZIhvcNAQEFBQADgYEAsOCS11P2ngyn4YqigZedyiAL
  31. 5tZnIibJ90nTrmQ++HybBj9JQA3aM1CEx+F8xRlcEnCR3jLLXgf3E1fM3s2Do6es
  32. iEyfqMtBrMcuoNNqzwSk3wgTYNS3NDkVczRVwpMS0Nn6OIBW+2XkloQ/qUlJ9+yM
  33. K1CQNuCkJc9ZPpETC+M=
  34. -----END CERTIFICATE-----"
  35.  
  36. key_str = "-----BEGIN PRIVATE KEY-----
  37. MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAN5oJZQP5hUIy3xJ
  38. 6UGxwmd2yJvpeHN3eQM/iUfJ2QKIi+hWrlgsyYo+QAflYUJUlQwgPOTAUtcQhvz3
  39. uGsVw/jh56NxLbZM/cjg99B9MxwcEmPLNts+SsvzhSGfCbvDxOvZBsrMSJ5hcNGt
  40. QMko+8tLukjemKtxgiGk02H0kpk5AgMBAAECgYEA2qPRxXO3wZfqyt2yNIX20lXA
  41. sx1a71BVI69TWsKA1u+7coW8USx+WKwHsHt8GIQkHk6W7l5vUcOKoKc6ofM8udrU
  42. OxDnZ0xEKjFWSITWdR42pGr/qSRpxWHeuGRn9tCEL8DOXNHiAglHxRQpFybZKciI
  43. PHH3lQu1y7ndzYGdTIECQQDxdais6+GFY+xWhrPfW2ANCHny61igOLNkeM9Eizfm
  44. GhVmvqaUQo79i/qvoFVU/xYwdroqqqyIIJ1ljO77VTUJAkEA68zFLftdUGcG3UmG
  45. RGdODdLj2a90cJQb/EBKOCFKzPqKdBXWrd/DkidvHrmqvvRG9GMfd9q4ZZ3eQYi0
  46. oDr+sQJAYgOb283Idugv6JO3ckRaQhAdyJDmIevCTleH80/7+ei+pT1gyzAVcTCg
  47. KyiPWvhNHpEjUuyDKqLqoW1LGTTmWQJBAKo1fuPpPXuLUxYrO6Nm2p357AU3tJqL
  48. HwRgN/L6fS8nbwfKt9N84YQ/uON57Hm4hPtmDdILbO3VHhk6IABFdZECQHbC8Dvb
  49. tfj5htbU+aGKykoAQGVBBdPVcSrl9ZzTsvC7yHJ1pPrID3Zy8cVNtDa7k43wEnXw
  50. Kln4xhBcsEKap/0=
  51. -----END PRIVATE KEY-----"
  52.  
  53. @list_str = "Dest=83;CompatibleSystemSoftwareVersion=3.2100-;
  54. Dest=83;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  55.  
  56. Dest=84;CompatibleSystemSoftwareVersion=3.2100-;
  57. Dest=84;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  58.  
  59. Dest=85;CompatibleSystemSoftwareVersion=3.2100-;
  60. Dest=85;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  61.  
  62. Dest=86;CompatibleSystemSoftwareVersion=3.2100-;
  63. Dest=86;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  64.  
  65. Dest=87;CompatibleSystemSoftwareVersion=3.2100-;
  66. Dest=87;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  67.  
  68. Dest=88;CompatibleSystemSoftwareVersion=3.2100-;
  69. Dest=88;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  70.  
  71. Dest=89;CompatibleSystemSoftwareVersion=3.2100-;
  72. Dest=89;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  73.  
  74. Dest=8A;CompatibleSystemSoftwareVersion=3.2100-;
  75. Dest=8A;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  76.  
  77. Dest=8B;CompatibleSystemSoftwareVersion=3.2100-;
  78. Dest=8B;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  79.  
  80. Dest=8C;CompatibleSystemSoftwareVersion=3.2100-;
  81. Dest=8C;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;
  82.  
  83. Dest=8D;CompatibleSystemSoftwareVersion=3.2100-;
  84. Dest=8D;ImageVersion=00000000;SystemSoftwareVersion=3.2100;CDN=http://lolz.com;CDN_Timeout=30;"
  85.  
  86. cert = OpenSSL::X509::Certificate.new(cert_str) # (File::read(cert_file))
  87. key = OpenSSL::PKey::RSA.new(key_str)  #(File::read(key_file))
  88.  
  89. @ctx = OpenSSL::SSL::SSLContext.new()
  90. @ctx.key = key
  91. @ctx.cert = cert
  92.  
  93. server = TCPServer.new(localHost, localPort)
  94. webServer = TCPServer.new(localHost, 80)
  95.  
  96. port = server.addr[1]
  97. addrs = server.addr[2..-1].uniq
  98.  
  99. puts "*** HTTPS listening on #{addrs.collect{|a|"#{a}:#{port}"}.join(' ')}"
  100.  
  101. port = webServer.addr[1]
  102. addrs = webServer.addr[2..-1].uniq
  103.  
  104. puts "*** HTTP listening on #{addrs.collect{|a|"#{a}:#{port}"}.join(' ')}"
  105.  
  106. # abort on exceptions, otherwise threads will be silently killed in case
  107. # of unhandled exceptions
  108. #Thread.abort_on_exception = true
  109.  
  110. # have a thread just to process Ctrl-C events on Windows
  111. # (although Ctrl-Break always works)
  112. #Thread.new { loop { sleep 1 } }
  113.  
  114. def connThread(local)
  115.         port, name = local.peeraddr[1..2]
  116.         puts "*** receiving from #{name}:#{port}"
  117.  
  118.         puts local.gets
  119.  
  120.         local.write("HTTP/1.1 200/OK\r\nContent-Type: text/plain\r\nContent-Length: #{@list_str.size}\r\n\r\n#{@list_str}")
  121.         local.close
  122.  
  123.         puts "*** done with #{name}:#{port}"
  124. end
  125.  
  126. def sslConnThread(local)
  127.         port, name = local.peeraddr[1..2]
  128.         puts "*** [SSL] receiving from #{name}:#{port}"
  129.  
  130.         sslLocal = OpenSSL::SSL::SSLSocket.new(local, @ctx)
  131.         sslLocal.accept
  132.  
  133.         # open connection to remote server
  134.         remote = TCPSocket.new($remoteHost, $remotePort)
  135.  
  136.         sslRemote = OpenSSL::SSL::SSLSocket.new(remote)
  137.         sslRemote.connect
  138.  
  139.         # start reading from both ends
  140.         loop do
  141.                 ready = select([sslLocal, sslRemote], nil, nil, 120)
  142.                 if ready.nil?
  143.                         puts "timeout"
  144.                         break
  145.                 end
  146.                 if ready[0].include? sslLocal
  147.                         # local -> remote
  148.                         begin
  149.                                 data = sslLocal.sysread($blockSize)
  150.                         rescue EOFError
  151.                                 puts "local end closed connection"
  152.                                 break
  153.                         end
  154.  
  155.                         sslRemote.write(data.sub('X-Platform-Version: PS3 03.55', 'X-Platform-Version: PS3 03.56'))
  156.                 end
  157.                 if ready[0].include? sslRemote
  158.                         # remote -> local
  159.                         begin
  160.                                 data = sslRemote.sysread($blockSize)
  161.                         rescue EOFError
  162.                                 puts "remote end closed connection"
  163.                                 break
  164.                         end
  165.                         sslLocal.write(data)
  166.                 end
  167.         end
  168.  
  169.         sslLocal.close
  170.         local.close
  171.         sslRemote.close
  172.         remote.close
  173.  
  174.         puts "*** [SSL] done with #{name}:#{port}"
  175. end
  176.  
  177. if not defined?(Ocra)
  178.         loop do
  179.                 # whenever server.accept returns a new connection, start
  180.                 # a handler thread for that connection
  181.                 ready = select([server,webServer], nil, nil)
  182.                 if ready[0].include? server
  183.                         Thread.start(server.accept) { |local| sslConnThread(local) }
  184.                 end
  185.                 if ready[0].include? webServer
  186.                         Thread.start(webServer.accept) { |local| connThread(local) }
  187.                 end
  188.         end
  189. end
  190.  
  191. # vim: set ts=4 sw=4 sts=4 tw=120
clone this paste RAW Paste Data