require

2019强网杯babybank wp及浅析

一笑奈何 提交于 2019-11-28 16:04:54
前言 2019强网杯CTF智能合约题目--babybank wp及浅析 ps:本文最先写在我的新博客上,后面会以新博客为主,看心情会把文章同步过来 分析 反编译 使用 OnlineSolidityDecompiler 对合约进行逆向,获取合约源码伪代码 参考其他师傅的分析,贴出美化之后的合约源码 pragma solidity ^0.4.23; ​ contract babybank { // 0xe3d670d7 0 mapping(address => uint) public balance; // 0xd41b6db6 1 mapping(address => uint) public level; // 2 address owner; // 3 uint secret; ​ //Don't leak your teamtoken plaintext!!! md5(teamtoken).hexdigest() is enough. //Gmail is ok. 163 and qq may have some problems. event sendflag(string md5ofteamtoken,string b64email); ​ constructor()public{ owner = msg.sender; } ​ //0x8c0320de function

The difference between “require(x)” and import x

我们两清 提交于 2019-11-28 16:03:42
I've just started working on a small node project that will interface with a MongoDB. However, I cannot seem to get the relevant node modules to import correctly, even though I have installed them correctly via npm . For example, the following code throws and error, telling me that "express has no default export": import express from "express"; However, this code works: const express = require("express"); So my question is, what is the difference in how the import and variable/require methods function? I'd like to fix whatever is plaguing my imports on the project, as it seems likely to cause

Node2-1环境&调试----CommonJS

♀尐吖头ヾ 提交于 2019-11-28 15:43:59
CommonJS 每个文件是一个模块,有自己的作用域 在模块内部 module 变量代表模块本身 module.exports 属性代表模块对外接口 require规则 /表示绝对路径,./表示型对于当前文件的(相对路径) 支持 js,json,node 拓展名,不写依次尝试,都找不到就会报错 不写路径则认为build-in模块或者各级 node_modules 内的第三方模块 require特性 module被加载的时候执行,加载后缓存(只加载一次) 一旦出现某和模块被循环加载,就只输出已经执行的部分,还未执行的部分不会输出 require特性1的例子: 02_cusmod.js console.log('this is a module'); const testVar = 100; function test(){ console.log(testVar); } //对外进行两个输出 module.exports.testVar = testVar module.exports.testFn = test; 调用它的 04_cache.js require('./02_cusmod.js'); require('./02_cusmod.js'); 如果不是只加载一次的话,那么运行04_cache.js控制台就会输出两次 this is module 这句话 可是

Node.js “require” function and parameters

感情迁移 提交于 2019-11-28 15:43:28
问题 When I do: lib = require('lib.js')(app) is app actually geting passed in? in lib.js: exports = module.exports = function(app){} Seems like no, since when I try to do more than just (app) and instead do: lib = require('lib.js')(app, param2) And: exports = module.exports = function(app, param2){} I don't get params2 . I've tried to debug by doing: params = {} params.app = app params.param2 = "test" lib = require("lib.js")(params) but in lib.js when I try to JSON.stringify I get this error:

前端利器躬行记(2)——Babel

夙愿已清 提交于 2019-11-28 14:49:51
  Babel是一个JavaScript编译器,不仅能将当前运行环境不支持的JavaScript语法(例如ES6、ES7等)编译成向下兼容的可用语法(例如ES3或ES5),这其中会涉及新语法的转换和缺失特性的修补;还支持语法扩展,从而能随时随地的使用JSX、TypeScript等语法。目前最新版本是7.4,自从6.0以来,Babel被分解的更加模块化,各种转译功能都以插件的形式分离出来,可按自己的需求,灵活配置。   在7.0版本中,对Babel的包做了一次大调整,统一改成域级包,将原先以“babel-”为前缀的包迁移到@babel的命名空间,例如@babel/core、@babel/cli等。这种模块化的设计,既能区分是否是官方发布的,也能避免命名冲突。 一、@babel/core   如果要以编程的方式使用Babel,那么可以通过@babel/core实现,安装命令如下所示。 npm install --save-dev @babel/core   在引入该包后,就能在JavaScript文件中直接编译代码、文件或AST。以编译代码为例,可选择的方法有三个,如下所示。 var babel = require("@babel/core"); babel.transform(code, options, function(err, result) { console.log

【前端知识体系-NodeJS相关】NodeJS高频前端面试题整理

为君一笑 提交于 2019-11-28 14:47:16
1. 为什么JavaScript是单线程? 防止DOM渲染冲突的问题; Html5中的Web Worker可以实现多线程 2.什么是任务队列? 任务队列"是一个先进先出的数据结构,排在前面的事件,优先被主线程读取。主线程的读取过程基本上是自动的,只要执行栈一清空,"任务队列"上第一位的事件就自动进入主线程。 2.1 同步和异步任务 同步任务指的是,在主线程上排队执行的任务,只有前一个任务执行完毕,才能执行后一个任务; 异步任务指的是,不进入主线程、而进入"任务队列"(task queue)的任务,只有"任务队列"通知主线程,某个异步任务可以执行了,该任务才会进入主线程执行。 2.2 执行流程 所有同步任务都在主线程上执行,形成一个执行栈(execution context stack)。 主线程之外,还存在一个"任务队列"(task queue)。只要异步任务有了运行结果,就在"任务队列"之中放置一个事件。 一旦"执行栈"中的所有同步任务执行完毕,系统就会读取"任务队列",看看里面有哪些事件。那些对应的异步任务,于是结束等待状态,进入执行栈,开始执行。 主线程不断重复上面的第三步。 3. 什么是事件循环(EventLoop)? 主线程从"任务队列"中读取事件,这个过程是循环不断的,所以整个的这种运行机制又称为Event Loop(事件循环)。 3.1 定时器函数的基本使用方法对比?

Use of require(lib) versus <script> in Electron apps

微笑、不失礼 提交于 2019-11-28 14:18:48
I don't have a handle on when to use require('jslib') versus <script src=""></script> in Electron content pages (e.g. index.html). With jQuery, I discovered that it needs to be loaded as follows: <script>window.$ = window.jQuery = require('./js/jquery-2.2.4.min.js');</script> I need to start using some other libraries (e.g. Handlebars, ds3.js, Bootstrap, etc.) and I am not sure if I should be loading those with the <script> tag or if I should require them. Some libraries only expose their variables through a CommonJS interface. Others, like jQuery, will also expose them as global variables.

How are require, require_dependency and constants reloading related in Rails?

旧城冷巷雨未停 提交于 2019-11-28 13:50:32
问题 How are require and require_dependency different? How can require_dependency automatically reload classes in development but require can't ? I digged into Rails' ActiveSupport::Dependencies and dispatcher.rb code. What I saw in require_dependency 's code is it basically adds the constants to an autoloaded_constants array. But it gets cleared in clear_application inside dispatcher after each request. Can someone give a clear explanation or point me to some resources which will help? 回答1:

8天从零学习PHP-day1 PHP初探

依然范特西╮ 提交于 2019-11-28 13:19:37
这一章主要对PHP基础语法进行学习,篇幅可能过长。 首先我们都要明白一个道理,学习一门语言不是一蹴而就的事情,一篇博客也不可能穷尽PHP的方方面面。从会到精通,需要一个漫长的过程。我只是最快的方式学会PHP,而不是精通PHP。 一、语法 因为语法实在太多,没办法全部覆盖讲解。我这里语法的这一部分,适合了解一些编程语言的人看。作为快速入门。 这里假设你已经具备一门其他编程语言的基本知识。如果你是完全的编程新手,建议你去PHP官网系统的学习这部分内容。 https://www.php.net/manual/zh/langref.php 特性 语法简单,开发速度快,效率高,学习成本低。 简单但功能强大,非常适合web网站开发。 服务端脚本语言运行速度快,无需编译。 跨平台能力强。 特点 面向对象的语言。 弱类型,动态类型语言。 没有main入口。 具有访问域关键字。 多线程语言。 多继承语言。 关键字 __halt_compiler() abstract and array() as break callable (as of PHP 5.4) case catch class clone const continue declare default die() do echo else elseif empty() enddeclare endfor endforeach endif

tailwiind init

牧云@^-^@ 提交于 2019-11-28 12:57:02
1. init npm init -y npm install tailwindcss postcss-cli autoprefixer npx tailwind init 2. postcss.config.js const purgecss = require('@fullhuman/postcss-purgecss')({ content: [ './src/**/*.html', './src/**/*.vue', ], defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [] }) module.exports = { plugins: [ require('tailwindcss'), require('autoprefixer'), ...process.env.NODE_ENV === 'production' ? [purgecss] : [] ] } 3. src/css/tailwind.css @tailwind base; @tailwind components; @tailwind utilities; 4. package.json "scripts": { "dev": "postcss src/css/tailwind.css -o public/css/all