0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DHCPでIPがズレてしまった会社の自分用作業PCのIPを探した話

Last updated at Posted at 2022-04-07

動機

テレワークは良いのですが、会社の自分のPCのIPがわからなくなりました。
こまったこまった。

というわけで、IP を探そうっていう単純な動機。

最初は ExPing で ping の通る IP を探してひとつひとつリモートデスクトップで接続・・・とかやったのですが、3 つめでやってらんねーってなりました。

で、ポートスキャンの大御所 nmap なのですが、WSL (WSL2 にあらず) の bash で実施してもうまくいかないのですね。
WSL2 にするのも、msys やら cygwin やらを自宅のPCに入れるのも大げさ・・・。

なので powershell の出番かなと。

結果

環境は Windows10 に最初からインストールされている PowerShell 。
VPN につながっている状態で PowerShell のコマンドラインから

$ProgressPreference="SilentlyContinue"

して、次に

for ($i=128; $i -le 256; $i+=1) { Test-NetConnection 192.168.128.$i -Port 3389 -InformationLevel Quiet }

Test-NetConnection は最初に ping でつながるかどうかをテストするので、ping の通らない IP が入ると、とても遅いです。

あととてもいいかげんなので、以下の通りポートが開いてない IP はわかるのですがそうでない IP は表示されません。そこは人間の目で判断しました。

警告: TCP connect to (192.168.128.128 : 3389) failed
False
警告: TCP connect to (192.168.128.129 : 3389) failed
False
警告: TCP connect to (192.168.128.130 : 3389) failed
False
警告: TCP connect to (192.168.128.131 : 3389) failed
False
警告: TCP connect to (192.168.128.132 : 3389) failed
False
警告: TCP connect to (192.168.128.133 : 3389) failed
False
True
警告: TCP connect to (192.168.128.135 : 3389) failed
False

これで 少なくともリモートデスクトップが動いている IP はわかったぞ・・・
あとは一台ずつ・・・うがー

感想

うちの会社セキュリティガバガバなんで、そんな環境だからできることかもしれません。
まぁ、特定ポートの開いてる端末を探す需要は他にもあるでしょというわけで。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?