投稿時間:2021-06-05 23:30:37 RSSフィード2021-06-05 23:00 分まとめ(34件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 残プロ 第-4回 ~生存確認をLINENotifyで~ https://qiita.com/R1nY1x1/items/ef444ea809a8061e8adc 2021-06-05 22:59:36
python Pythonタグが付けられた新着投稿 - Qiita scikit-learn導入時にOSErrorが出たときのメモ https://qiita.com/h-nabata/items/0c07792d4ef6f69b4e18 Windowsではデフォルトでパス名の文字数が文字までに制限されているので、以下の投稿を参考に文字数制限を解除しました。 2021-06-05 22:56:57
python Pythonタグが付けられた新着投稿 - Qiita Pythonでつくる雑VTuber ~Jetson Nanoで顔認識~ https://qiita.com/soymushroom/items/5ce3e1c4fd1050819c7c またね参考NVIDIAJETSONNANO開発者キットを動かすのに必要なものHelloAIWorld【Docker】初めてのdockerでimageまで作成Tkinterを使うのであればPySimpleGUIを使ってみたらという話CallReferencePySimpleGUIPythonsocket通信の使い方サンプル解説画像ファイル転送し、ディープラーニングの認識結果を取得【Kerasラズパイ】Pythonオブジェクトを漬物Pickleにするアルファチャンネルつきpngを透過画像で貼り付けるwithPythonOpenCVOpenCVで日本語フォントを描写するを関数化するpyvirtualcamNVIDIA社のシングルボードコンピュータ。 2021-06-05 22:07:11
js JavaScriptタグが付けられた新着投稿 - Qiita センター試験の数学をJSで解く【数学Ⅰ・A】_1 https://qiita.com/ebjtvlf/items/8e19fab5b64a8af4a419 2021-06-05 22:24:43
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) AdonisJsでLravelのbladeのoldを実現したい https://teratail.com/questions/342383?rss=all AdonisJsでLravelのbladeのoldを実現したいいつもお世話になっております。 2021-06-05 22:55:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) gridがうまく適用されずレイアウトが崩れます。 https://teratail.com/questions/342382?rss=all gridがうまく適用されずレイアウトが崩れます。 2021-06-05 22:30:40
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) zipコマンドで別々の階層をのもを1つのzipにまとめたい https://teratail.com/questions/342381?rss=all zipコマンドで別々の階層をのもをつのzipにまとめたい前提・実現したいことfunctionstestjsfunctionstestjsnodemodulesこれをfunctionzipにまとめたいです。 2021-06-05 22:27:02
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) [React] 2次元配列を含めたテーブルのページネーションについて https://teratail.com/questions/342380?rss=all React次元配列を含めたテーブルのページネーションについて開発環境reactnbspv実装内容次元配列のデータに応じて、行が追加されるテーブルを実装しています。 2021-06-05 22:24:52
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) vpc_idをサブネットリソースに渡す際のTerraformでの記載方法について https://teratail.com/questions/342379?rss=all vpcidをサブネットリソースに渡す際のTerraformでの記載方法について前提・実現したいことTerraformにてAWS環境上でVPCとSubnetの簡単な構成を作成したく思っております。 2021-06-05 22:19:13
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CSSで装飾が混在してしまいます https://teratail.com/questions/342378?rss=all 2021-06-05 22:19:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) react native iOSでの実機ビルドエラー M1 mac https://teratail.com/questions/342377?rss=all reactnativeiOSでの実機ビルドエラーMmacReactnbspNativeのiOS実機ビルドについて質問させてください。 2021-06-05 22:16:50
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) firebaseのデータを削除したい https://teratail.com/questions/342376?rss=all firebaseのデータを削除したい現在、googlenbspboolsnbspapiを用いた本の検索と気になる保管機能の実装したサイトを制作しております。 2021-06-05 22:16:01
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) phpにおけるif文における分岐に関するエラー https://teratail.com/questions/342375?rss=all phpにおけるif文における分岐に関するエラー前提・実現したいこと今回nbspifissetPOSTnbspaposnameaposnbspampampissetPOSTnbspaposopinionaposnbspからif分岐させることで、新規入力と編集を分けております。 2021-06-05 22:09:19
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Rails】localeを使いこなして国際化向けのアプリと化そう! https://qiita.com/ren0826jam/items/230e5c4ea070c3c69977 configlocalesgreetjaymljawordgreetinghelloこんにちは使用する際はint〇〇と言ったように階層を「」で繋ぐ。 2021-06-05 22:24:53
Linux Ubuntuタグが付けられた新着投稿 - Qiita ubuntu インストール https://qiita.com/amaki22/items/6bcbe82a19a73b332774 ubuntuインストール今まで仮想マシンだと、重すぎてサクサク進まなかったので、思い切ってubuntuをインストールしてみることにしました。 2021-06-05 22:26:52
Linux Ubuntuタグが付けられた新着投稿 - Qiita ubuntu server 20.04 LTS IPアドレス固定 https://qiita.com/narapon16119/items/1ffbb65e325bdcdaf7d5 meserversaddressesversion 2021-06-05 22:15:56
Docker dockerタグが付けられた新着投稿 - Qiita Docker PostgreSQL を起動するコマンド https://qiita.com/kazokmr/items/48200cc2188d27d5d536 2021-06-05 22:09:31
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】localeを使いこなして国際化向けのアプリと化そう! https://qiita.com/ren0826jam/items/230e5c4ea070c3c69977 configlocalesgreetjaymljawordgreetinghelloこんにちは使用する際はint〇〇と言ったように階層を「」で繋ぐ。 2021-06-05 22:24:53
技術ブログ Developers.IO AWS SDK for JavaScriptで、「多要素認証(MFA)をしてAssumeRole(スイッチロール)」するスクリプトを書いてみた https://dev.classmethod.jp/articles/aws-sdk-for-javascript-mfa-assume-role/ assumerole 2021-06-05 13:27:08
海外TECH Ars Technica Reducing poverty can actually lower energy demand, finds research https://arstechnica.com/?p=1770116 climate 2021-06-05 13:00:31
海外TECH DEV Community Webpack settings when upgrading Vue2 to Vue3.1 for Rails application https://dev.to/t0yohei/webpack-settings-when-upgrading-vue2-to-vue3-1-for-rails-application-19pe Webpack settings when upgrading Vue to Vue for Rails applicationThis is the setting content that corresponds to of the article below vue next packages vue compat at master ·vuejs vue next ·GitHubThe content is based on the assumption that you are using the webpacker v system Also at the time of writing the article I am using the beta of Vue Versionrails webpacker vue beta vue compat beta vue loader PreparationBesed on the content of vue next packages vue compat at master ·vuejs vue next ·GitHub we will update vue loader to and vue vue compat to the series Modify package json as shown below and run yarn install or npm install dependencies vue vue compat vue loader Modify webpack settingsModify config webpack loaders vue js and config webpack environment js as follows if config webpack loaders vue js has not been created create a new one config webpack loaders vue jsmodule exports test vue erb use loader vue loader options compilerOptions compatConfig MODE config webpack environment jsconst environment require rails webpacker const VueLoaderPlugin require vue loader const vue require loaders vue environment config merge resolve alias vue vue compat environment plugins prepend VueLoaderPlugin new VueLoaderPlugin environment loaders prepend vue vue module exports environment Sample commit Update vue to by tyohei ·Pull Request ·tyohei rails vue app ·GitHub Confirmation of operationIf the settings are correct when you run bin webpack or bin webpacker dev server you will get warnings and errors like the attached image Next To DoAfter changing the settings of the webpack it will be a task to crush the warnings and errors that appear in the build For the subsequent work refer to and later below vue next packages vue compat at master ·vuejs vue next ·GitHubWhen all the work is completed successfully the migration to Vue is complete Appendix If you have TypeScript installedIf you want to get type support from the implementation of import Vue from vue it seems that you need the following settings in shim d ts declare module vue import CompatVue from vue runtime dom const Vue CompatVue export default Vue 2021-06-05 13:19:07
海外TECH DEV Community Reasons to use Typescript https://dev.to/sergchr/reasons-to-use-typescript-1ig6 Reasons to use TypescriptTypescript is a superset of Javascript It s Javascript with type definitions and the code will be checked when compiling Why to adopt TS if Javascript is fast to prototypeWe can code fast with Javascript The language is simple and allows us to do a lot of things A prototyping time can be amazingly short A downside of this is code readability If we need to prototype something quickly to understand if the idea is viable we skip thinking about architecture writing documentation tests Eventually we have a working piece It has some bugs but they can be fixed relatively fast The piece is doing its intended job we add more functionality to it but some problems start to emerge To add a simple functionality it s hard to understand whether some service passes you an object with fields a string or it may not pass anything at all It s difficult to fathom API contracts between code pieces you wrote By writing more console log s you see the contracts and adjust the code to new requirements After some time your colleague asks a team s help to assist in debugging what these objects are Next month a manager asks why it takes so long to modify a tiny bit of the functionality The company even hired additional developers for the last week In the next week the CEO along with CTO decided to rewrite the product from scratch Could the situation be different if the team adopted Typescript Not really But TS could help to eliminate bugs initially and with the next releases Plus it would take less time to modify existing code Why Doesn t TS add more time to write because you should think about types write them down We ll get back to this question Typescript eliminates problems when you write the codeIDEs have great TS support so they will highlight potential errors you encounter But what kind of errors Imagine you construct an object convert it to some other form pass it to a chain of functions and then send the result to UI It s easy to follow the object properties when constructing it in the beginning It s difficult to follow a contract further The next function can remove necessary fields from the object another one will add some new ones etc With Typescript you code how the object should look like what properties are required what are optional and this contract will be followed Otherwise you ll get compile errors and errors highlights before that Another situation there is a function that should be returning a number but returns undefined The function is complicated and we can t exactly know where the problem occurs i e why it can t handle import calculateXfromNum from otherService there is a function from other service it calculates some number from other number this function should return number at least we expect that judging by the codeconst num calculateXfromNum num is undefined this function expect a numberdoStuffWithResult num error It improves code readabilityHave you struggled with situations where you didn t know what to expect from functions rd party services responses Like in the example above Types allow you to see what other functions take as arguments and what they ll return Have you seen the console log debugging process To understand what form an object has people log it to the output a few times along the function execution You could use debugger also it may help more But why make things so complicated Isn t it enjoyable to know what this class method returns from the first glance at the code The subsequent question you may derive from the reasons above may be What about the time we spend on documenting types and writing more code The coding won t be so fast then It accelerates the development processHow is that possible If you think you will document all the types when using TS thus it slows you down that s not the case Typescript is smart enough to infer types from code In cases where it can t do that you need to indicate a type explicitly For example const n n is number here num can t be inferred because you can pass anything here TS can t know thatfunction fn num return num if you point that num is number TS knows the returning type will be a number toofunction fn num number return num Still even if Typescript can infer types in simple cases a developer should write complex types so how the development becomes faster How much time do you think developers in mid large size JS projects spend on debugging to understand what an object will be returned by some function I think a lot We don t write code for machines but humans The code should be understandable You take a glance and you get a basic idea of what s going on Learning Typescript syntax takes a few minutes to start coding if you already understand Javascript What you need to know is how to declare type interface Then you need some time to get used to advanced cases The additional development time will go to defining types which isn t so time consuming At least it takes much less time than asking a colleague where to find documentation about a service asking a colleague who wrote that asking the person who wrote that to explain what the form of an object is writing comments about object type after debugging it rewriting the comments because you didn t expect other use cases Save yourself and your team many human hours of reading and understanding the code How to migrate to TypescriptI ll provide points for you to decide is it worth adopting at all and how simple the process is It s easy to learnUnderstand how to declare types interfaces and you re good to go Basically it s type Human name string age number const me Human name Sergiy While you write more code you ll get to know many other things along the way It s easy to start right awayIf you have a Javascript project already all it takes for you to start writing TS code is to have Typescript installed maybe some tsconfig configuration and to set the allowJs flag so you can mix TS with JS code As you code more you ll add more types and maybe you convert all the codebase to TS At least you can TSify crucial parts of the code right now However you ll need to compile the project to Javascript An additional build step in your workflow If you re convinced to switch or migrate to Typescript there are some thoughts to ponder about As a person who leads a team you should be responsible to explain to the developers why do you choose TS what are pros and cons Otherwise programmers may think of it as a tool that slows them down You may encounter situations when a developer write something like that function parse payload any options object any While it s a valid code it doesn t add more readability A developer may find using any is a good thing to save time The idea the developers should understand is that if something is unknown it s better to figure out the actual type and document it Almost the same situation with wide types like object the data may be an object with any properties a function an array The more narrow type the better SummaryUse Typescript if you need better code readability hence development speed up in the long run It takes a little time to get started with TS if you know Javascript You can integrate TS in your Javascript project without rewriting JS parts right away Typescript is a tool that should be regarded as such and not as a thing that solves abstract problems like improving the code Follow me on Twitter and see my other articles 2021-06-05 13:15:26
海外TECH DEV Community Creating your React project from scratch without create-react-app: The Complete Guide. https://dev.to/underscorecode/creating-your-react-project-from-scratch-without-create-react-app-the-complete-guide-4kbc Creating your React project from scratch without create react app The Complete Guide Creating and setting up your own React project from scratch can be at times a little bit tricky even though it s not your first time starting a React project That s why we have create react app a command that prepares and installs all the boilerplate for us and have our application ready to rock from the very first moment after the process finishes But even though create react app is a very good choice to start off with specially for those who are new to the React world or who just don t want to spend time setting up everything it s interesting to know that there s another way to get things done As you can imagine this method is not going to be as easy as just running a command but it will surely be way more satisfactory and useful for your developer career not to mention that it s a reusable process and you ll get rid of not that necessary stuff that comes together with create react app and that will overload your project Note that I won t be using a specific structure for the project because I think that s very personal and every developer works in a different way so I leave that choice up to you So with all this said let s dive into it Step Creating the folder that will host our projectWe re going to start by creating a new directory for our project at a location of our choice mkdir my react projectOnce created we re going to navigate into it cd my react project Step Initializing the projectTo initialize our project we re going to run a npm command npm is a package version and dependencies manager made for JavaScript If you haven t installed npm yet you need to directly install Node js since they work together and npm is included in Node js installation as well Node js will let us execute JavaScript on server side You can perfectly use a different package manager like Yarn or Bower If you re not sure if you have previously installed npm Node js just run the following commands to check the last versions installed for them If these commands return a version number then you already have them on your computer Otherwise you ll need to install them again npm vnode vOnce we have npm and Node js ready to use on our computer we re going to run the following command npm initThis command will create a package json file which is the file where all the dependencies and scripts for our project will be specified Throughout the process of the file creation the terminal will pop up some questions to let you set up your project with proper information about it If you want to skip the current question just press enter to jump onto the next one If you don t feel like giving extra information for the project or just want to configure it later just add the y flag to the command npm init yOnce the installation is done we ll have a new package json file in our project that will look like this name my react project version description main index js scripts test echo Error no test specified amp amp exit keywords author license ISC Step Installing dependenciesWe also need to install a few dependencies manually in order for our future React application to work properly and as expected React dependenciesWe ll be installing the following dependencies on React s side react the JavaScript library we ll be working with react dom package with some methods to manage DOM elements react router dom package that contains the DOM bindings for React Router npm install react react dom react router dom Webpack dependenciesWe ll also need a module bundler to get our project ready for the web Webpack bundles all the JavaScript files in your project and prepares all the necessary resources for usage in the browser As we only need Webpack to work in the development environment we re going to install all its related dependencies adding the flag save dev or simply D to the command We ll be installing the following dependencies on Webpack s side webpack the bundler webpack cli CLI for Webpack npm install save dev webpack webpack cli Babel dependenciesBabel is a JavaScript compiler that converts or transpiles JavaScript ES to JavaScript ES since not all browsers currently support ECMAScript features The Babel related dependencies we re going to install are the following babel core Babel compiler core babel preset react package that contains a set of plugins used to support React features npm install save dev babel core babel preset reactBefore going further on dependencies we re going to configure Babel in our project in order for our JavaScript files to be transpiled as intended Let s go back to the terminal to create a new file for this configuration touch babelrcThen just add the following code snippet babelrc presets babel preset react Loaders for WebpackWebpack needs something called loaders to preprocess files They are useful to bundle static resources beyond JavaScript These will be the basic loaders we ll be working with babel loader loader for Babel html loader loader for HTML style loader loader that injects styles into the DOM css loader loader for CSS sass loader loader for SASS SCSS This loader is not strictly necessary but in case you want to use a CSS preprocessor you ll need a loader for it as well There also exists loaders for LESS PostCSS Stylus npm install save dev babel loader html loader style loader css loader sass loader Webpack pluginsWe also need Webpack plugins that will help for bundling purposes html webpack plugin this plugin is used to create HTML files that will serve bundles Note Since we re working in a development environment we ll just be using a loader for styles but for production builds it recommended to extract the CSS from the bundle using MiniCssExtractPlugin This plugin extracts CSS into separate files and creates files for every JavaScript file which contains CSS The loader is faster and will set the styles as internal inside the lt style gt tag while the plugin will link the external styles file to the HTML document using the lt link gt tag Server dependenciesOur app will also need a server so we ll be using server related dependencies as well We re going to install the following express Node js framework that we ll be using to create our server file and to handle server requests nodemon tool that will refresh our web app whenever a change occurs in the app directory npm install expressnpm install save dev nodemon Step Configuring WebpackNext step is putting Webpack s loaders and plugins we just installed together in a config file to let it know how its behavior should be in the bundle process of our files To start with we re going to create an empty file for this purpose Back on the terminal touch webpack config jsBefore diving into the content of this config file we re going to see what it really does and how it behaves First off we need to tell Webpack which the entry point for our app will be This entry point will be a JavaScript file called index js We also need to specify the output file which will be the final JavaScript file all bundled and the only one that will be referenced explicitly from the HTML file served At this point it s important to mention the dist folder This folder is a directory created as part of the bundling process and will hold all the static files generated as a result of it More stuff Webpack needs to know is the type of files it ll be working with to translate them properly For the moment those types are JavaScript HTML CSS and SASS SCSS But if in the future we need to work with more different kind of files and we definitely will such images fonts etc these will need their own loaders as well And finally we also need to configure the necessary plugins In this case HtmlWebpackPlugin which will generate the HTML that will be served to the browser webpack config jsconst path require path const webpack require webpack const HTMLWebpackPlugin require html webpack plugin module exports entry index js output filename bundle js path path resolve dist publicPath module rules test js jsx exclude node modules use babel loader test html use html loader Choose only one of the following two if you re using plain CSS use the first one and if you re using a preprocessor in this case SASS use the second one test css use style loader css loader test scss use style loader css loader sass loader plugins new HTMLWebpackPlugin template index html Step Creating the HTML templateWell this is the simplest step but still we need to take it We need to create a basic HTML document that will be used by HTMLWebpackPlugin as a template to generate the new one As easy as that index html lt DOCTYPE html gt lt html gt lt head gt lt title gt My React App lt title gt lt head gt lt body gt lt div id root gt lt div gt lt body gt lt html gt Pay attention to the empty lt div gt with id root We ll learn about it later Step Creating the serverThe server is going to be a new JavaScript file that will open up a port to listen on do a little bit more of configuration and make a few requests touch app jsWe re going to call it app js but you can give it any name of your choice Just be careful with capitalization You ll understand why later app jsconst express require express const app express const path require path const port process env PORT app listen port gt console log The app server is running on port port const DIST DIR path join dirname dist const HTML FILE path join DIST DIR index html app use express json app use express static public app use express static dist app get req res gt res sendFile HTML FILE function err if err res status send err What we are doing in this file is starting a new server that listens on port for connections Then the HTML file generated by Webpack is sent to the root URL in other words this HTML will be the homepage of our app We re also indicating that every file in the directories public and dist will be static and should be treated as such Step Creating the React appNow we re going to create App js which will be the main component of our React app capitalization alert here App jsimport React from react const App gt return lt div gt Hello World lt div gt export default App The render of this component will be injected into the served HTML so what we ll see when we open up the browser will be Hello World Let s take a look at how we can do this Step Creating the entry point for the React appIn this step we re going to specify the routing for our app and also where in the DOM the content from React should be inserted index jsimport React from react import ReactDOM from react dom import BrowserRouter as Router Route Switch from react router dom import App from App js import styles scss const appRouting lt Router gt lt Switch gt lt Route exact path component App gt lt Switch gt lt Router gt ReactDOM render appRouting document getElementById root We re just indicating that the App component should be rendered when the URL matches the root path exactly and that the render content should be placed inside the tag with id root in the index document Step Defining the scriptsAnd finally we re going to set up the scripts to be able to build and run our app Back in package json we initially had something like this in the scripts section scripts test echo Error no test specified amp amp exit Now we re going to add a couple more run and build like this test echo Error no test specified amp amp exit build rm rf dist amp amp webpack mode development dev nodemon app js Step Building and running our appLast step is finally building and running our app We first need to run a build command to bundle everything npm run buildAnd then just run it npm run devOur app is now available at localhost And that s it Now we have our React application ready to start working with it If you ve reached this point thank you very much I hope that this tutorial has been helpful for you and I ll see you all in the next Don t forget to follow me on Instagram and Twitter for more related content 2021-06-05 13:06:56
海外TECH DEV Community How Fuzzing with QEMU (and AFL) Works https://dev.to/galtashma/how-fuzzing-with-qemu-and-afl-works-4og0 How Fuzzing with QEMU and AFL Works Whats a Fuzzer A fuzzer now days is a automated testing tool to find security bugs It does so by generating many inputs to be executed until on of them crashes the target program In other words the objective is to crash a program but how can we guide the fuzzer in the right direction AFL added to the objective a notion of code coverage Any input that reaches an area in the code that was unreachable before is interesting Even if it did not crash the program we can mutate that input to get even more coverage we call this feedback Over the past years coverage had proved to be a great feedback mechanism but collecting it was not simple if one did not own the source code of the target binary Enter QEMU FuzzingAFL originally used compile time instrumentation to insert assembly instructions at the beginning of each basic block Basic Block is the group of assembly instructions that are always executed one after the other When executed these snippets would write a byte to a shared memory area where fuzzer can observe and determine which basic blocks had been reached This method works well if you have the source code and can compile it with your custom instrumentation but what if you are fuzzing a closed source binary One cool example of fuzzing closed source binaries would be Effective Fuzzing Qmage QEMU is an emulator that can emulate many cpu architectures For example it can run Android arm on your PC x or run Windows on your iPad UTM By patching QEMU TriforceAFL and AFL managed to get coverage feedback out of any binary that QEMU can run How cool is that So How does it Work QEMU user mode is a tool of QEMU that allows emulating just the userspace in contrast to the normal mode where both the user mode and the kernel are emulated This is done by forwarding any syscalls from the target program to the host machine The main benefits are improved performance and less complex enviroment but it sacrifices on the portability AFL fork of QEMU uses this mechanism while adding coverage tracking and optional performance optimizations Example of running arm linux binaries on a x host AFLplusplus afl qemu trace fuzz bin harness lt lt lt aaaaaaaaaaaaaaaaaa harness starting main main at xb harness should backtrace argc harness input aaaaaaaaaaaaaaaa Getting the CoverageQEMU writes the coverage feedback data to shared memory this way both QEMU and the fuzzer can write and inspect the coverage data The fuzzer is responsible for allocating the shared memory When the fuzzer starts QEMU it passes the shared memory file descriptor to QEMU using the AFL SHM ID environment variable and maps the memory to its own process using shmat Then whenever the QEMU VM executes a basic block it marks the block as reached by writing to this shared memory This is implemented by the INC AFL AREA macro After QEMU exits the fuzzer can look at the shared memory for any bytes that are different from zero The offset from the start of the map is the ID of the visited basic block and the more bytes that are different from zero the more basic blocks our target has hit A redacted version of code from afl qemu related to the shared memory qemuafl imported config h define SHM ENV VAR AFL SHM ID accel tcg cpu exec cvoid afl setup void char id str getenv SHM ENV VAR if id str shm id atoi id str afl area ptr shmat shm id NULL if afl area ptr void exit accel tcg translate all cvoid HELPER afl maybe log target ulong cur loc register uintptr t afl idx cur loc afl prev loc INC AFL AREA afl idx afl prev loc cur loc gt gt qemuafl common h define INC AFL AREA loc afl area ptr loc Sample rust code for running QEMU and getting coverage from itfn main let shm id create shmem env set var AFL SHM ID format shm id run target in qemu let afl area ptr get shmem shm id let mut cov Vec lt u gt Vec new for i in xffff let value unsafe value afl area ptr add i if value println coverage at cov i value close shmem shm id Full example here AFL ForkServerJann Horn introduced the idea of a fork server to AFL In the fork server mode instead of running the target from the beginning each time we let the code arrive at a key point where we fork Then each time the QEMU exits the father process forks again This can be thought of a cheap snapshot mechanisem In this setup we have a fuzzer qemu father and qemu child the fuzzer and the qemu father communicate using pipes while the child is re spawned after each test case Each time the child is done the father can fork again to create another child This helps avoid running the setup code each time we want to run our target which helps improve performance In practice the communication between the fuzzer and the qemu father is made out of two pipes both are created by the fuzzer and given constant file descriptor ids using dup so the qemu father can easily find and open them The control pipe is used by the fuzzer to control the qemu father and the the Status pipe is used by the qemu father to update the fuzzer that he is alive NameOwnerR WIDCTL Control qemuReadCTL Control fuzzerWriten aST Status qemuWriteST Status fuzzerReadn aWhile cracking at the fork server mode one might ask why not just rewind the Virtual Machine back to the starting point instead of forking again This is exactly what I was thinking and haply there is a special mode that does exactly that Persistent Mode What is Persistent Mode Persistent mode can help improve the performance of your fuzzer even more It does so by reducing the amount of boilerplate code that has to be run in order to run our code much like the fork server mechanism but to a higher extreme So how does it work Every fuzzer needs to run a target multiple times each time with a different input and record the coverage Instead of re executing QEMU for each test case we can select a key main function which we will run in a loop and instead of closing the VM each time the target exits we jump right back to this main function In other words whenever the targets main function returns instead of returning to the caller we just jump again to the beginning of our main function This introduces new problems How can we know what coverage belongs to which input If we are just running the same code again why would the input be different Communication between Child and FatherAFL uses the two communication pipes just like in the fork server mode The manager creates new pipes before starting the QEMU process and using dup makes sure that each pipe has it s predefined file descriptor so the child can know to use them Our setup looks something like this fuzzer QEMU father QEMU child communicate using status and control pipes communicate using STOP and CONT signalsWe have the fuzzer communicating with the QEMU father using the control and status pipes Perviously using the fork server mode a new child was created for each test case making it easy for the father to know the status and passing the updates up to the fuzzer using the pipes In the persistent mode the child does not quit so we need another mechanism to let the father know what the status of the child This is done with STOP and CONT unix signals For each instruction emulated by QEMU by the disas a insn on arm the current program counter pc is compared to the address of our main function If they are equal we prepare the VM for a new test case and wait for the father to signal us to continue This function trace done each time the child resets itselfdisas a insn checks for pc curr afl persistent addr afl persistent loop is called and callsafl persistent iter After all this is done a SIGSTOP is raised and the execution is paused until the father sends back a SIGCONT To sum it up when the child is done with a test case it raises a STOP and then when the father is done preparing the next test case it sends back a CONT signal to the child The fathers implementation can be found inside afl forkserver Special handling for persistent mode if the child is alive but currently stopped simply restart it with SIGCONT kill child pid SIGCONT child stopped In persistent mode the father is responsible for bridging between the fuzzer and the child QEMU process Below is sample code to run a fuzzer with QEMU in persistent mode Sample code to run QEMU in persistent modefn main let control pipe Pipe new control pipe to owned let status pipe Pipe new status pipe to owned control pipe dup read FORKSRV FD status pipe dup write FORKSRV FD let child Command new qemuafl arg harness arg input file env AFL QEMU PERSISTENT ADDR lt address of main gt env spawn unwrap status pipe read i info forkserver is alive loop control pipe write i debug sent alive signal to child let child pid status pipe read i assert child pid gt debug child pid child pid let status status pipe read i debug status status each time we reach this point we know a testcase was fully executed We may want to read the coverage shared mem and write a new file to the input file prepare new testcase I hope you found this useful my twitter DMs are open at galtashma Sources 2021-06-05 13:03:18
海外科学 NYT > Science Blinded by Brighter Headlights? It’s Not Your Imagination. https://www.nytimes.com/2021/06/05/business/led-hid-headlights-blinding.html Blinded by Brighter Headlights It s Not Your Imagination The rising use of light emitting diodes and the popularity of pickups and S U V s have prompted complaints about the glare and intensity of headlights 2021-06-05 13:03:11
ニュース BBC News - Home G7: Rich nations back deal to tax multinationals https://www.bbc.co.uk/news/world-57368247 global 2021-06-05 13:14:28
ニュース BBC News - Home Covid: People in hospital with Indian variant not increasing significantly - NHS boss https://www.bbc.co.uk/news/uk-57367849 illness 2021-06-05 13:42:53
ニュース BBC News - Home Dozens killed in Burkina Faso attack https://www.bbc.co.uk/news/world-africa-57368536 islamist 2021-06-05 13:09:55
ニュース BBC News - Home Coventry celebrates start of UK City of Culture year https://www.bbc.co.uk/news/uk-england-coventry-warwickshire-57369328 coventry 2021-06-05 13:04:53
ニュース BBC News - Home Leclerc on pole for Azerbaijan Grand Prix after Sainz crash https://www.bbc.co.uk/sport/formula1/57369739 Leclerc on pole for Azerbaijan Grand Prix after Sainz crashFerrari s Charles Leclerc takes pole position from Lewis Hamilton and Max Verstappen in a thrilling qualifying session at the Azerbaijan Grand Prix 2021-06-05 13:50:14
ニュース BBC News - Home Svitolina out as seed exodus continues at French Open https://www.bbc.co.uk/sport/tennis/57369013 barbora 2021-06-05 13:43:00
LifeHuck ライフハッカー[日本版] 手のひらサイズで、しっかり明るい。ソーラー充電で500回使える折畳式軽量LEDライト【今日のライフハックツール】 https://www.lifehacker.jp/2021/06/234588lht-carry-the-sun.html carrythesun 2021-06-05 22:05:00
北海道 北海道新聞 U―24日本、ガーナに6―0 完勝、五輪へ親善試合 https://www.hokkaido-np.co.jp/article/552275/ 日本代表 2021-06-05 22:02:00
海外TECH reddit Charles Leclerc takes pole position for the 2021 Azerbaijan Grand Prix https://www.reddit.com/r/formula1/comments/nsvmtw/charles_leclerc_takes_pole_position_for_the_2021/ Charles Leclerc takes pole position for the Azerbaijan Grand Prix submitted by u overspeeed to r formula link comments 2021-06-05 13:22:29

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)