1
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 5 years have passed since last update.

Cisco Passlogicのワンタイムパスワードを自動抽出

Last updated at Posted at 2019-05-01

VPN接続するときにCisco AnyConnectを使っているところは多いだろう。
ものによっては48桁の番号から自分で手作業でワンタイムパスワードを生成しなければならない。
正直めんどくさい。
ということで、passlogicのサイトから番号を抽出してきて、自分の並び順に自動で並び替えることをpythonでやってみた

image.png
画像はここから転載

実際のコード

# coding: UTF-8
import requests
import urllib.request, urllib.error
from bs4 import BeautifulSoup
import lxml.html
import numpy as np

# アクセスするURL
r = urllib.request.urlopen("URL")
data = r.read().decode('utf-8')

soup = BeautifulSoup(data, 'html.parser')
#tdタグの部分だけa2に全部いれる
a2 = soup.find_all('td')

result =  []
bs = np.array([])
count = 0

for e in a2 :
    if count < (passlogicの取得MAX件数):
        result.append(e.getText())
        count += 1
else:
    arr = np.array(result)
    #自分で持っているpasslogicの並び
    bs = (arr[?],arr[?],arr[?],arr[?],arr[?],arr[?],arr[?],arr[?])
    print(np.char.strip(bs))

pythonすごい便利...

参考

https://qiita.com/Azunyan1111/items/9b3d16428d2bcc7c9406
https://qiita.com/Azunyan1111/items/b161b998790b1db2ff7a
他いくつかあったのですが...あとで記載します。

1
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
1
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?