douda5227 2015-04-30 10:23
浏览 28
已采纳

用于从服务器检索密码列表的PHP解决方案

Does anyone know how I can go about using a pure php solution for retrieving a list of ciphers supported by a remote server?

This is the code to test again a local client (web browser)

$ciphers = openssl_get_cipher_methods();

foreach($ciphers as $cipher) {
    echo "{$cipher}<br>";
}

Here is what I need to do

  1. I think what I need to do is create a socket connection to a remote connection
  2. I need to use a loop to connect with a different cipher each time.
  3. For each connection that is successfully established, it should print the name of the cipher we connected with.

Here is some code to establish a secure connection but need help to factor in the above requirements.

$url = $_REQUEST['host'];


$ssloptions = array(
    "capture_peer_cert" => false, 
    "allow_self_signed"=>false, 
    "CN_match"=>$url, 
    "verify_peer"=>false, 
    "SNI_enabled"=>true,
    "SNI_server_name"=>$url,
);

$ctx = stream_context_create( array("ssl" => $ssloptions) );
$result = stream_socket_client("ssl://$url:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ctx);
$cont = stream_context_get_params($result);

Here is a list of some ciphers we can use to connect with:

TLS_RSA_WITH_RC4_128_MD5

TLS_RSA_WITH_RC4_128_SHA

TLS_RSA_WITH_3DES_EDE_CBC_SHA

TLS_DHE_RSA_WITH_AES_256_CBC_SHA

TLS_DHE_RSA_WITH_AES_128_CBC_SHA

  • 写回答

1条回答 默认 最新

  • duanjing3656 2015-04-30 16:19
    关注

    I needed to add this to my socket array:

    'ciphers' => $value,

    I also created an array with all the ciphersuites and put it through a foreach ($ciphersuites_to_test as $value) to cycle through all the ciphers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。