Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Linuxコマンド一覧 |
https://qiita.com/Ryuichi_natsume/items/5b0502125cc9e5e5b5ab
|
linux |
2022-05-15 05:41:53 |
海外TECH |
MakeUseOf |
10 Keyboard Shortcuts That Work on Both Windows and Linux |
https://www.makeuseof.com/keyboard-shortcuts-work-both-windows-and-linux/
|
shortcuts |
2022-05-14 20:30:14 |
海外TECH |
DEV Community |
Force Send ETH - 2 |
https://dev.to/rushanksavant/force-send-eth-2-5b1l
|
Force Send ETH In the last post Force Send ETH we understood about selfdestruct and how it s used to forcefully send ETH to any contract Now let s take an example to understand what s the vulnerability in this Consider the following contract contract Crowdfund this contract only accepts a certain amount of funds if someone tries to send an amount that exceeds contract balance more than the limit tnx fails funds are transfered to an address only when contract balance equals fund limit uint fundLimit ether bool contractOpen true function donate external payable for others to donate eth to this contract require contractOpen Contract has stopped recieving funds require address this balance lt fundLimit Can t send specified amount note we cannot do address this balance msg value because address this balance already takes msg value function getBalance external view returns uint to get current balance of this contract return address this balance function sendFunds external to send all collected funds require contractOpen Contract has stopped recieving funds require address this balance fundLimit Fund limit not reached yet contractOpen false contract closed payable address xDCabEaCFcacCAcabaB transfer address this balance Now consider the following scenario Contract balance has reached ether but some hacker force sends extra ETH to CrowdFund contract address Now contract balance gt fundLimit hence require address this balance fundLimit Fund limit not reached yet from the sendFunds function will fail and not let anyone send the collected funds to required receiver Hope you got an idea about what exactly the vulnerability is Let s see the attacker contract contract Attacker fallback external payable function attack address crowdFund external selfdestruct payable crowdFund Till now we understood what exactly this vulnerability is and how hackers can take advantage of it Let s now see how to avoid such hacks one solution is to change require address this balance fundLimit Fund limit not reached yet to require address this balance gt fundLimit Fund limit not reached yet in sendFunds function of Crowdfund contract But what if that s an important condition for some application better solution is to avoid using address this to track fundsLet s see the following contract to understand this better contract CrowdFund safe uint fundLimit ether bool contractOpen true uint balance function donate external payable for others to donate eth to this contract require contractOpen Contract has stopped recieving funds require balance msg value lt fundLimit Can t send specified amount balance msg value function getBalance external view returns uint to get current balance of this contract return address this balance function sendFunds external to send all collected funds require contractOpen Contract has stopped recieving funds require balance fundLimit Fund limit not reached yet contractOpen false contract closed payable address xDCabEaCFcacCAcabaB transfer balance Now even if hacker force sends ETH to this contract it won t change the balance state variable hence this won t affect any conditions in the contract Hence the contract is safe from such attacks |
2022-05-14 20:46:50 |
海外TECH |
DEV Community |
Force Send ETH - 1 |
https://dev.to/rushanksavant/force-send-eth-1-2on1
|
Force Send ETH This vulnerability is due to a famous solidity functionality selfdestruct payable addressThat this is used to send all the ETH present in a contract to another contract at addressThat selfdestruct is operation at EVM level which clears all data from the contract and frees up space on the blockchain It is also quite cheaper than addressThat send this balance to send all eth to some other contract Let s see this with an example contract dontWant no payable function hence can t recieve eth function something external pure returns uint return function getBalance external view returns uint return address this balance Attacker contract Attacker receive external payable we will send ether to this contract function attack address dontWant payable external this contract will forecfully send all ether to dontWant selfdestruct payable dontWant function getBalance external view returns uint return address this balance When we send some ETH to Attacker contract and call attack function dontWant recieves ETH Any contract can send ETH to any other contract even if receiver contract has no receive fallback function using selfdestruct But why is this a vulnerability in the first place What s wrong in recieving free ETH You will get answers these in the next post Force Send ETH |
2022-05-14 20:18:30 |
海外TECH |
DEV Community |
JavaScript - Map |
https://dev.to/justtanwa/javascript-map-ko1
|
JavaScript MapHey hope y all are well Lets talk about Map in JavaScript Map ️Map in JavaScript JS allow you to store information data using a key value relationship But wait isn t that the same as an Object in JS Map does return Object when you use typeof but it is not exactly the same They are very similar in nature but they have distinct differences that determine their uses So what are these distinct differences Well if you are using Object the keys must be a String or Symbol datatype whereas the keys in Map can be any datatype including Function and Object Another thing is that to find the size of an Object you must do it manually e g grabbing all the keys using Object keys then counting the length But Map has a property size which return the size of the Map Additionally Objects are not directly iterable while with Maps you can Example Map comes with its own methods and you can see some of them below const cypher name Cypher color white const raze name Raze color orange const omen name Omen color blue const characterRoles new Map create an empty Map add new datacharacterRoles set cypher sentinel you can chain the method to add multiple entriescharacterRoles set raze duelist set omen smokes check sizecharacterRoles size iterablecharacterRoles forEach role char gt console log char name is a role Cypher is a sentinel Raze is a duelist Omen is a smokesAs I continue to learn more about Data Structure and Algorithm I learnt that Map is JavaScript s equivalent to a Hashmap and have been using them to solve some problems SummaryTo summarise Map allow you to store data as key value pairs that are not limited to String or Symbol datatype as keys It also give you the ability to directly iterate through the data Additionally Maps have it s own properties and methods that you can use to add access edit and delete the data in the collection Thank you for reading this short post please leave a comment if you want to add information or give feedback |
2022-05-14 20:15:45 |
Apple |
AppleInsider - Frontpage News |
Samsung prepares to raise chip production prices by up to 20% |
https://appleinsider.com/articles/22/05/14/samsung-prepares-to-raise-chip-production-prices-by-up-to-20?utm_medium=rss
|
Samsung prepares to raise chip production prices by up to Samsung will seemingly join the rest of the chip production industry in increasing the price to make semiconductors as chip foundries raise the cost of manufacturing important components used in modern electronic devices The global semiconductor crisis has prompted many chip making firms to raise their prices throughout and On Friday a report indicated that Samsung will finally follow the pack and issue its own price hikes Samsung is allegedly talking to clients to increase semiconductor pricing with the raises potentially reaching up to more than usual sources familiar with the matter told Bloomberg Depending on the difficulty of production such as sophisticated designs as well as other factors the cost increase to clients can be between and Read more |
2022-05-14 20:58:28 |
海外TECH |
Engadget |
'Zenless Zone Zero' is a new action RPG from the studio behind 'Genshin Impact' |
https://www.engadget.com/zenless-zone-zero-announced-201118401.html?src=rss
|
x Zenless Zone Zero x is a new action RPG from the studio behind x Genshin Impact x Genshin Impact developer Hoyoverse is working on a new project On Friday the studio shared the first trailer for Zenless Zone Zero an action RPG set in a modern urban setting Reminiscent of titles like The World Ends With You nbsp and Scarlett Nexus the game pits players against Ethereal monstrous creatures borne from another dimension In a nod to Neon Genesis Evangelion the action takes place in New Eridu one of the few cities to survive the devastation wrought by the Ethereal As a “Proxy you ll need to organize a disparate party of characters to battle the monsters Hoyoverse hasn t explicitly said how it plans to monetize Zenless Zone Zero but it sounds like the game will employ a similar system to the one found in Genshin Impact In other words expect to use real world money to improve your chances at obtaining some of the game s most powerful party members Zenless Zone Zero does not have a release date yet but you can sign up to take part in the game s closed iOS and PC beta by visiting its official website |
2022-05-14 20:11:18 |
ニュース |
BBC News - Home |
FA Cup final: Liverpool boss Jurgen Klopp says he 'could not be more proud' after beating Chelsea |
https://www.bbc.co.uk/sport/football/61450534?at_medium=RSS&at_campaign=KARANGA
|
FA Cup final Liverpool boss Jurgen Klopp says he x could not be more proud x after beating ChelseaLiverpool boss Jurgen Klopp could not be prouder of his side after they again outlast Chelsea on penalties to win the FA Cup |
2022-05-14 20:41:01 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
すき家、マック、丸亀製麺…外食20社 「値上げ断行」企業の勝敗は?【値上げ率リスト付き】 - 食料争奪戦 日本の食卓が危ない |
https://diamond.jp/articles/-/303204
|
丸亀製麺 |
2022-05-15 05:27:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
空き家の借り上げからマッチングまで、頼りになる「空き家向けサービス」続々登場 - 有料記事限定公開 |
https://diamond.jp/articles/-/302384
|
借り上げ |
2022-05-15 05:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
成功する人はなぜ「見た目を重視」する?田中角栄にも鉄の掟があった - 「超一流」の流儀 |
https://diamond.jp/articles/-/303188
|
古今東西 |
2022-05-15 05:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ゴジラやラドンも手掛けた東宝の2代目特撮美術監督「井上泰幸展」がすごい! - ビジネスを強くする教養 |
https://diamond.jp/articles/-/303059
|
見どころ |
2022-05-15 05:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
源義経に敗れた木曽義仲に「粗暴なイメージ」が染みついた理由 - 新説・新発見!今こそ学ぶ「歴史・地理」 |
https://diamond.jp/articles/-/303174
|
源義経に敗れた木曽義仲に「粗暴なイメージ」が染みついた理由新説・新発見今こそ学ぶ「歴史・地理」現在放送中の大河ドラマ『鎌倉殿の人』でも注目を集めた武将、木曽義仲。 |
2022-05-15 05:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
子どもの将来を決める、学歴より大切な「たった一つのスキル」とは?[見逃し配信] - 見逃し配信 |
https://diamond.jp/articles/-/303210
|
関連 |
2022-05-15 05:05:00 |
コメント
コメントを投稿