EExcel 丞燕快速查詢2

EExcel 丞燕快速查詢2
EExcel 丞燕快速查詢2 https://sandk.ffbizs.com/

sqlmap



docker https://hub.docker.com/r/googlesky/sqlmap

執行指令:

docker run --rm -it -v /tmp/sqlmap:/root/.sqlmap/ googlesky/sqlmap -h

GET

docker run --rm -it -v /tmp/sqlmap:/root/.sqlmap/ googlesky/sqlmap --url='https://test.com/date=2020-04-01' --level=5 --risk=3

POST & header token

docker run --rm -it -v /tmp/sqlmap:/root/.sqlmap/ googlesky/sqlmap --url='http://oo.xx.oo.xx:5000/user/info' --headers='Authorization: bearer eyJhbGcoooooxxxxxoooooxx......' --data='{id: "u123"}' --level=5 --risk=3

nodejs moment moment-timezone

Use express, moment, moment-timezone


const moment = require('moment-timezone');


app.get('/moment', (req, res) => {
  const datestr = '2020-07-01';

  res.status(200).json({
    local_offset: moment(datestr).utc(),
    local_unix: moment(datestr).unix(),
    zone0_unix: moment(datestr).zone(0).unix(),
    zone8_unix: moment(datestr).zone(8).unix(),
    timezone0_unix: moment.tz(datestr, 'GMT').unix(),
    timezone8_unix: moment.tz(datestr, 'Asia/Taipei').unix(),
  });
});

// No use, just for keep 
function dateForTimezone(offset, d) {
  // Copy date if supplied or use current
  d = d? new Date(+d) : new Date();

  // Use supplied offset or system
  offset = offset || -d.getTimezoneOffset();
  // Prepare offset values
  var offSign = offset < 0? '-' : '+'; 
  offset = Math.abs(offset);
  var offHours = ('0' + (offset/60 | 0)).slice(-2);
  var offMins  = ('0' + (offset % 60)).slice(-2);

  // Apply offset to d
  d.setUTCMinutes(d.getUTCMinutes() - offset);

  return offSign + offHours + ':' + offMins;

  // Return formatted string
  return d.getUTCFullYear() + 
    '-' + ('0' + (d.getUTCMonth()+1)).slice(-2) + 
    '-' + ('0' + d.getUTCDate()).slice(-2) + 
    'T' + ('0' + d.getUTCHours()).slice(-2) + 
    ':' + ('0' + d.getUTCMinutes()).slice(-2) + 
    ':' + ('0' + d.getUTCSeconds()).slice(-2) + 
    '.' + ('000' + d.getUTCMilliseconds()).slice(-3) +
    offSign + offHours + ':' + offMins; 
  
}

IMPORT


Server timezone 0

Client time zone +8


Server run result:


{
  "local_offset": "2020-06-30T16:00:00.000Z",
  "local_unix": 1593532800,
  "zone0_unix": 1593532800,
  "zone8_unix": 1593532800,
  "timezone0_unix": 1593561600,
  "timezone8_unix": 1593532800
}



Client run result:


{
  "local_offset": "2020-07-01T00:00:00.000Z",
  "local_unix": 1593561600,
  "zone0_unix": 1593561600,
  "zone8_unix": 1593561600,
  "timezone0_unix": 1593561600,
  "timezone8_unix": 1593532800
}


Conclusion



moment().zone().unix()  Auto fix zone / utc

moment("").tz("GMT").unix()  Auto fix zone / utc



moment().tz("", "GMT").unix()  No auto fix zone / utc

typeorm connection



const typeorm = require("typeorm");
const connectionManager = require("typeorm").getConnectionManager();

  //const connectionManager = typeorm.getConnectionManager();
  const connected = connectionManager.has("default");
  if(!connected){
      // ? load connection options from ormconfig or environment
        //const connectionOptions = await getConnectionOptions();
        connectionManager.create({
          //name: "default",
          type: "mysql",
          // "extra": {
          //   "socketPath": "/cloudsql/ooxxooxx"
          // },
          host: "oo.xx.oo.xx",
          port: 3306,
          username: "root",
          password: "ooxxooxx",
          database: "ooxxdb",
          synchronize: false,
          logging: true, // this.env === 'dev' ? true : false
          ssl: SSL,
          keepConnectionAlive: false,
      });
  }

  try {
    db = connectionManager.get();
    if(!connected){ 
        await db.connect(); 
        console.log('connect .... OK!');
    }
  }catch(error) {
    console.log("TypeORM Error: ", error);
  };

  var ranks = await db.query("select * from users");