<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>twilio &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/twilio/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Wed, 09 Jul 2025 07:04:46 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>twilio &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Text Adventures Via Text Message]]></title>
		<link>https://shkspr.mobi/blog/2013/06/text-adventures-via-text-message/</link>
					<comments>https://shkspr.mobi/blog/2013/06/text-adventures-via-text-message/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Fri, 14 Jun 2013 10:55:20 +0000</pubDate>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[interactive fiction]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[twilio]]></category>
		<category><![CDATA[zork]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=8386</guid>

					<description><![CDATA[Remember text adventures, eh?  They were pretty nifty!  &#34;You are in a maze of twisty little passages, all alike&#34; &#62;Go East &#34;You have been eaten by a Grue. A dwarf starts singing about gold&#34;  Smashing! Just like the pictures are better on the radio, so the graphics are immeasurably superior when they&#039;re in your head. Don&#039;t get me wrong, I love the 5.1 surround sound snarl of a rabid beast rendered…]]></description>
										<content:encoded><![CDATA[<p>Remember text adventures, eh?  They were pretty nifty!</p>

<pre>"You are in a maze of twisty little passages, all alike"
&gt;Go East
"You have been eaten by a Grue. A dwarf starts singing about gold"</pre>

<p>Smashing! Just like the pictures are better on the radio, so the graphics are immeasurably superior when they're in your head. Don't get me wrong, I love the 5.1 surround sound snarl of a rabid beast rendered in 1080p - but nothing is <em>quite</em> as good as using your imagination.</p>

<p>Text Adventures - or, more properly, <em>Interactive Fiction</em> - is enjoying a mini-renaissance at the moment.  There are emulators for smart phones, computers, and consoles.</p>

<p>But for SMS? None that I could find.  Think about it; SMS is close to the perfect medium for Interactive Fiction.  Your commands are concise enough to fit into a single message, you don't have to worry about the speed of your response, everything is text based.</p>

<p>So, I present to you, Zork via SMS (with a little help from <a href="http://twilio.com/">Twilio</a>).</p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2013/06/Twilio-Zork-SMS-fs8.png" alt="Twilio Zork SMS" width="600" height="1033" class="aligncenter size-full wp-image-8391">

<p>Brilliant!</p>

<h2 id="howto"><a href="https://shkspr.mobi/blog/2013/06/text-adventures-via-text-message/#howto">HOWTO</a></h2>

<p>Although superficially a simple project, there are a few gotchas along the way.  This documentation is mostly for me - but may be of use to you :-)</p>

<p>Let's start at the end.... Using <a href="https://www.twilio.com/">Twilio</a> you can send an SMS to a phone number, that is then POSTed to a webserver of your choice.</p>

<p>Twilio will send an SMS back if it receives a response such as</p>

<pre><code class="language-xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
  &lt;sms&gt;You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.
&lt;/sms&gt;
&lt;/response&gt;
</code></pre>

<p>Easy enough.  (NB the free account prepends your messages with a trial message. Once you pay, that goes away.)</p>

<p>So, how do we get a text adventure like Zork running server side?  There are plenty of client side emulators out there - but I only found one which was purely server side.</p>

<p><a href="https://web.archive.org/web/20141212015043/http://devel.thcnet.net/thcnetdev/index.php?section=article,29588">THCnet</a> have a PHP interpreter for Zork.  It's slightly cludgy - but it works.  I'm checking to see if I can distribute it on GitHub.</p>

<p>The game library "dtextc.dat" must be installed in "/usr/games/lib/".  The source code is available if you want to recompile it and place it somewhere more accessible.</p>

<p>A MySQL database needs to be created to keep track of users and sessions.</p>

<p>A temporary directory (which must be readable and writeable) will also be needed to store the state of play for each session.  I've used "tmp/404/" but you can alter config.php to point wherever is convenient.  You will also need to adjust index.php and functions.php with the new location.</p>

<p>Finally, the executable "zork" must be runable.</p>

<p>That's pretty much it.</p>

<p>When a user (or, in this case, Twilio) first makes a request to the URL, we check to see if they already have a session cookie.
If they don't, create one, and start the game by returning the opening text.</p>

<p>For every subsequent connection, we check the state of the game based on their cookie, then apply the body of their SMS to the game engine.  Whatever Zork spits out, we return as an SMS.</p>

<p>By default, Twilio kills unused sessions after 4 hours, and all cookies will be lost.</p>

<h2 id="where-next"><a href="https://shkspr.mobi/blog/2013/06/text-adventures-via-text-message/#where-next">Where Next?</a></h2>

<p>It strikes me that the various forms of text adventures are excellent as a sort of mini-IVR.  A nice little finite-state-machine which can quite happily run for years.  Services like <a href="https://web.archive.org/web/20130603122624/https://www.frontlinesms.com/">Frontline SMS</a> are great for information sharing, but they're really not designed for this sort of work.</p>

<p>Could we use interactive fiction in places where SMS is cheap but other forms of entertainment are expensive?  Could IF be used to augment existing media events?  SMS is lowest common denominator - even iPhones can use it.</p>

<p>But, for now, all I have to worry about is someone texting me "Go west'); DROP TABLE ..." ;-)</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=8386&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2013/06/text-adventures-via-text-message/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Protecting Against Credit Card Scams]]></title>
		<link>https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/</link>
					<comments>https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Mon, 09 Jul 2012 12:26:24 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[fraud]]></category>
		<category><![CDATA[scam]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[tropo]]></category>
		<category><![CDATA[twilio]]></category>
		<category><![CDATA[voice]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=6063</guid>

					<description><![CDATA[I recently read about an innovative telephone call scam.  A scammer rings the mark and asks for her credit card details.  If the mark refuses, the scammer tells her to hang up the phone, then dial 999 and ask for &#34;Sergeant Scammer of the Fraud Squad&#34;.  The mark does so, and is connected to what they assume is the emergency services.  However, because the scammer hasn&#039;t hung up at their end, the…]]></description>
										<content:encoded><![CDATA[<p>I recently read about <a href="http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/news/427284/warning-dial-999-card-fraud-scam">an innovative telephone call scam</a>.</p>

<p>A scammer rings the mark and asks for her credit card details.  If the mark refuses, the scammer tells her to hang up the phone, then dial 999 and ask for "Sergeant Scammer of the Fraud Squad".</p>

<p>The mark does so, and is connected to what they assume is the emergency services.  However, because the scammer hasn't hung up at their end, the call is still active.  So the mark isn't speaking to 999, but to the scammer.</p>

<p>Pretty devious.  Luckily, it can't work on mobile.  But it got me thinking - how could you get someone to give you credit card details over the phone?  I'm inspired by both <a href="http://www.schneier.com/blog/archives/2006/06/movieplot_threa_1.html">Bruce Schneier's "Movie Plot Threat"</a> competitions and <a target="_blank" href="http://www.amazon.co.uk/mn/search/?_encoding=UTF8&amp;camp=1634&amp;creative=19450&amp;field-keywords=mitnick&amp;linkCode=ur2&amp;tag=shkspr-21&amp;url=search-alias%3Daps&amp;x=0&amp;y=0" rel="noopener">Kevin Mitnick's work on Social Engineering</a>.<img src="https://www.assoc-amazon.co.uk/e/ir?t=shkspr-21&amp;l=ur2&amp;o=2" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;"></p>

<p>Trying to think like "the enemy" is a crucial part of understanding how nefarious people can exploit a situation. I think it should be considered the seventh "<a href="http://en.wikipedia.org/wiki/Six_Thinking_Hats">thinking hat</a>".</p>

<h2 id="the-goal"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#the-goal">The Goal</a></h2>

<p>I want the victim to willingly give me her credit card details.  I do not want her to be suspicious or report my activity to the police.</p>

<h2 id="the-strategy"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#the-strategy">The Strategy</a></h2>

<ul>
    <li>The victim receives a text on her phone.</li>
    <li><blockquote>"Your Barclay's credit card (starting 4304) was recently used to buy £2,103.54 worth of goods in China. If you wish to dispute this transaction, please call 0113 496 0123."</blockquote></li>
    <li>The victim checks her BarclayCard - it <em>does</em> start 4304. Damn!  She rings the number.</li>
    <li>"Welcome to the BarclayCard fraud line," says the voice at the other end.</li>
    <li>"To protect your security, please type in your sixteen digit card number," says the automated voice.  So that's what the victim does.</li>
    <li>... after typing in several more details, the victim finally gets through to the scammer.</li>
    <li>At this point, the scammer can attempt to get more information - such as home address - or simply assure the victim that the fraud has been reported.</li>
    <li>"Unfortunately," the fraudster says, "the £2,103.54 will show up on your July statement.  But you will see the refund on the August statement."</li>
</ul>

<h2 id="how-it-works"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#how-it-works">How It Works</a></h2>

<p>There are a number of factors which go into making this a potentially successful scam.</p>

<ol>
    <li>People are quite used to receiving texts from their card issuer.</li>
    <li>It's quite common to be asked to confirm a suspicious transaction.</li>
    <li>Credit cards number have a <a href="https://www.creditcardvalidator.org/country/gb-united-kingdom">predictable start sequence</a>.  That's why credit card receipts often show you only the last few digits.  This tricks the victim into thinking that the scammer knowa two crucial pieces of information; the credit card issuer and the credit card number.</li>
    <li>We're trained not to give details to strangers who ring us up.  By contrast, we're expected to give details to people <strong>when we ring them</strong>!</li>
    <li>You can't argue or otherwise interrogate an IVR.  You either have to give that disembodied voice your details or hang up.</li>
    <li>Again, we're quite used to typing in our credit card details and then pressing the hash key!</li>
    <li>If we do get through to a real person, the standard Social Engineering tricks all apply.  Only, in this case, not only is the victim worried about the potential fraud, she has also primed herself into thinking she's speaking with her credit card provider.</li>
    <li>At this point, the scammer knows that they can use the card for a fraudulent purchase <em>and the victim won't report it</em>! It will only be after two statements have been received that the victim will notice that she hasn't been refunded.</li>
</ol>

<h2 id="problems"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#problems">Problems</a></h2>

<p>Now, this fraud isn't without issue.  The most notable being that you do not know who has a credit card issued by a specific provider.  The scammer would either need some third party intelligence that their victims all use HSBC, or they could just go on a phishing expedition.  Spam a few thousand numbers and there will bound to be a few which have the card which is being targeted.</p>

<h2 id="how-to-do-it"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#how-to-do-it">How To Do It</a></h2>

<p>Using services like <a href="https://www.twilio.com/">Twilio</a> and <a href="https://web.archive.org/web/20120510161936/https://www.tropo.com/home.jsp">Tropo</a>, it's quite easy to create a telephone menu.  It can play back a recorded voice, save all the user's keypresses, then pass the call on to the scammer.</p>

<p>They can even handle the automated sending of the text messages, playing back different messages depending on the caller - "Welcome to HSBC", "Welcome to American Express", etc.</p>

<h2 id="defending-against-this-scam"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#defending-against-this-scam">Defending Against This Scam</a></h2>

<p>There are three main strategies for defending against this scam - and they all boil down to trust</p>

<h3 id="dont-trust-an-unknown-phone-number"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#dont-trust-an-unknown-phone-number">Don't Trust An Unknown Phone Number</a></h3>

<p>Save your credit card provider's phone number in your address book.  That is the only number you should ring.  If someone rings you - tell them that you will take their name and call them back on the official number.  If you receive a text - call the official number to check it is legitimate.</p>

<h3 id="dont-trust-partial-information"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#dont-trust-partial-information">Don't Trust Partial Information</a></h3>

<p>The first few numbers of your credit card are fairly generic.  Trusting someone who guesses your Visa Electron starts with "4197" is like trusting a psychic who says "You were a bit of a handful growing up, especially in your teens."  It's such general information as to be worthless.</p>

<h3 id="dont-trust-the-other-person"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#dont-trust-the-other-person">Don't Trust The Other Person</a></h3>

<p>I sometimes act deviously.  When asked to give my address, I'll give an incorrect house number or post code.  If the person at the other end doesn't pick up on the mistake, I assume I'm talking to a scammer.  Similarly, you don't have to trust interactive menus.  You can input incorrect information, and see if it is accepted without complaint - a sure sign of a scam.  Or see if it gets you through to a human.</p>

<h2 id="is-this-scam-possible"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#is-this-scam-possible">Is This Scam Possible?</a></h2>

<p>One hurdle is targeting enough people who have the "correct" credit card.  The scam would work without the credit card info, but may be less effective.</p>

<p>The cost of sending out the texts is also a constraint.  Although text bundles are relatively cheap now.</p>

<p>Shutting down the numbers - or tracing them - is perhaps the biggest issue.  Buying a disposable pre-pay SIM is virtually anonymous.  A landline number is probably fairly easy to trace - assuming the police have the time and staffing levels to investigate such a scam.</p>

<p>And that may be the deciding issue.  If someone reports a suspicious text to the police or their credit card provider, how quickly can the number be shut down?  If the scammer is sending out hundreds of fraudulent SMS an hour, it would only take a few responses to make the scheme worthwhile.</p>

<h2 id="disclaimer"><a href="https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/#disclaimer">Disclaimer</a></h2>

<p>Naturally, you should not attempt this.  The penalties for credit card fraud a very serious.  This is intended as a thought experiment.</p>

<p>If you want people to willingly give up their credit card information - take a look at the <a href="https://twitter.com/NeedADebitCard">morons on Twitter posting photos of their cards</a>!</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=6063&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2012/07/protecting-against-credit-card-scams/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
