Skip to content

Instantly share code, notes, and snippets.

@blacknon
blacknon / python_prompt_toolkit_test.py
Last active January 30, 2023 02:45
python_prompt_toolkitの動作検証用のスクリプト
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
from prompt_toolkit import prompt
from prompt_toolkit.completion import FuzzyWordCompleter
# 単語の候補
my_completer = FuzzyWordCompleter(
["apple", "goole", "japan", "hoge", "hello world", "good morning"]
)
@blacknon
blacknon / example_p11_getsinger_bk5.go
Last active February 12, 2023 09:39
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / example_p11_getsinger_bk4.go
Last active January 30, 2023 02:24
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / example_p11_privprint.go
Last active January 30, 2023 02:25
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / example_p11_getsinger.go
Last active January 30, 2023 02:25
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto"
@blacknon
blacknon / example_p11_pubprint.go
Last active January 30, 2023 02:19
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内のpublic keyをssh-rsa形式で出力するsampleコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内のpublic keyをssh-rsa形式で出力するsampleコード
package main
import (
"crypto/rsa"
"crypto/x509"
@blacknon
blacknon / ssh_term_x11forwarding.go
Last active August 21, 2023 08:51
goでx11フォワーディング付きでssh接続でシェルを利用する検証・サンプルコード(動く)
// Test only on Mac
package main
import (
"crypto/sha1"
"errors"
"fmt"
"io"
"math/rand"
@blacknon
blacknon / notworking_ssh_term_x11forwarding.go
Last active August 14, 2023 07:59
goでx11フォワーディング付きでssh接続でシェルを利用する検証・サンプルコード(動かない)
package main
import (
"errors"
"fmt"
"os"
"os/signal"
"syscall"
"golang.org/x/crypto/ssh"
@blacknon
blacknon / ssh_term_ssh_config_proxy_command.go
Last active January 30, 2023 02:22
goで~/.ssh/configからホストの情報やproxyに関する情報を取得してssh接続でシェルを利用する検証・サンプルコード
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"os/exec"
"os/signal"
@blacknon
blacknon / ssh_term_cert.go
Last active January 30, 2023 02:17
goで証明書認証してsshでシェルに接続する検証・サンプルコード
package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"os/user"
"strings"