Dec 14, 2021

golang OTP just simple play

1. main package : https://github.com/xlzd/gotp package main import ( "fmt" "time" "github.com/xlzd/gotp" ) func main() { totp := gotp.NewDefaultTOTP("4S62BZNFXXSZLCRO") // ini cara create paling simple // klo mau custom bs pake gotp.NewTOTP(secret, 6, 30, nil) secret=string, 6=digits, 30=interval in second code := totp.Now() mytime := int(30 - time.Now().Unix()%30) unixtime := int(time.Now().Unix()) fmt.Println("pertama : ", totp.Verify(code, mytime), mytime) fmt.Println("kedua : ", totp.Verify(code, unixtime), unixtime) fmt.Println("bedanya : ", totp.Verify(code, unixtime+28)) time.Sleep(8 * time.Second) unixtime = int(time.Now().Unix()) fmt.Println("kedua : ", totp.Verify(code, unixtime), unixtime) //myjeda := int(90 - time.Now().Unix()%90) newcode := totp.At(unixtime + 90) // akan hidup pd jam sekarang + 90 detik (sebelum waktu itu di anggap false), dan jangka hidupnya tetep 30 detik // time.Sleep(33 * time.Second) fmt.Println("ketiga : ", totp.Verify(newcode, unixtime+30)) fmt.Println("keempat : ", totp.Verify(newcode, unixtime+60)) fmt.Println("kelima : ", totp.Verify(newcode, unixtime+91)) fmt.Println("keenam : ", totp.Verify(newcode, unixtime+100)) fmt.Println("ketujuh : ", totp.Verify(newcode, unixtime+121)) } ------------- pertama : false 30 kedua : true 1257894000 bedanya : true kedua : true 1257894008 ketiga : false keempat : false kelima : true keenam : true ketujuh : false Program exited.
Read more ...

Aug 14, 2021

[solved] py3o.formats can not installed

 

well, just simple solution, 


1. download source file 

2. python3 setup.py install

3. sudo vim models/ir_actions_report.py 

4. 

import sys


egg_path='/opt/odoo13/odooaddons/report_py3o/models/py3o.formats/dist/py3o.formats-0.3-py3.6.egg'

sys.path.append(egg_path)

import py3o.formats


5. restart odoo then install the module

Read more ...

Mar 11, 2021

odoo 13 on ubuntu 20 ssl error, [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1123)

sudo vim /etc/ssl/openssl.cnf

at first line add

openssl_conf = default_conf

#

# OpenSSL example configuration file.

# This is mostly being used for generation of certificate requests.

#


# Note that you can include other files from the main configuration

# file using the .include directive.

#.include filename


at the end of line add 

                                # identifier (optional, default: sha1)

[ default_conf ]


ssl_conf = ssl_sect


[ssl_sect]


system_default = ssl_default_sect


[ssl_default_sect]

MinProtocol = TLSv1.2

CipherString = DEFAULT:@SECLEVEL=0


its to solve the error message [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1123)

Read more ...