<?xml version="1.0" encoding="UTF-8"?>
<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>chris moos&#039;s blog &#187; spoof</title>
	<atom:link href="http://chrismoos.com/tag/spoof/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrismoos.com</link>
	<description>developer by day, developer by night</description>
	<lastBuildDate>Fri, 30 Jul 2010 04:52:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Writing a FreeSWITCH Caller ID spoofing&#160;interface</title>
		<link>http://chrismoos.com/2009/10/16/writing-a-freeswitch-caller-id-spoofing-interface/</link>
		<comments>http://chrismoos.com/2009/10/16/writing-a-freeswitch-caller-id-spoofing-interface/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 00:06:21 +0000</pubDate>
		<dc:creator>Chris Moos</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[callerid]]></category>
		<category><![CDATA[freeswitch]]></category>
		<category><![CDATA[spoof]]></category>

		<guid isPermaLink="false">http://chrismoos.com/?p=583</guid>
		<description><![CDATA[Lately I have been really interested in voice over IP, I think there is a lot of power in it. I was using Asterisk, but I&#8217;ve moved onto a much better and more powerful solution, FreeSWITCH. I was playing with it recently and decided a Caller ID spoofing interface would be fun.
When the following script [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I have been really interested in voice over IP, I think there is a lot of power in it. I was using Asterisk, but I&#8217;ve moved onto a much better and more powerful solution, <a href="http://freeswitch.org/">FreeSWITCH</a>. I was playing with it recently and decided a Caller ID spoofing interface would be fun.</p>
<p>When the following script is ran, it will prompt you for an access code, and if it is correct, it will let you specify a number to spoof, and a number to call. Its fun <img src='http://chrismoos.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Also, it can send an email whenever a spoofed call is made (if you want to track your friends usage, for example).</p>
<p>To use the following script, put this in your dialplan: (I&#8217;ve put spoof.py in the fspy package.)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;python&quot;</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;fspy.spoof&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<h3>spoof.py</h3>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>,<span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">from</span> freeswitch <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> mktime
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">httplib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">random</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">smtplib</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_number<span style="color: black;">&#40;</span>session,invalid,num=<span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>:
	digits = session.<span style="color: black;">getDigits</span><span style="color: black;">&#40;</span>num, <span style="color: #483d8b;">&quot;#&quot;</span>, <span style="color: #ff4500;">6000</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> digits == <span style="color: #483d8b;">''</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> invalid == <span style="color: #ff4500;">3</span>:
			session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'You have entered too many in valid entries. Goodbye.'</span><span style="color: black;">&#41;</span>
			session.<span style="color: black;">hangup</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Invalid entry. Please try again.'</span><span style="color: black;">&#41;</span>
			get_number<span style="color: black;">&#40;</span>session,invalid+<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>:
		<span style="color: #ff7700;font-weight:bold;">return</span> digits
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> handler<span style="color: black;">&#40;</span>session, args<span style="color: black;">&#41;</span>:
	session.<span style="color: black;">answer</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	session.<span style="color: black;">set_tts_parms</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cepstral'</span>, <span style="color: #483d8b;">'Allison'</span><span style="color: black;">&#41;</span>
&nbsp;
	session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Please enter the 4 digit access code.'</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">code</span> = get_number<span style="color: black;">&#40;</span>session,<span style="color: #ff4500;">2</span>,num=<span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">code</span> == <span style="color: #008000;">None</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #dc143c;">code</span> <span style="color: #66cc66;">!</span>= <span style="color: #483d8b;">'6969'</span><span style="color: black;">&#41;</span>:
		session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Invalid access code, goodbye!'</span><span style="color: black;">&#41;</span>
		session.<span style="color: black;">hangup</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">return</span>
	session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Please enter the number you would like to spoof.'</span><span style="color: black;">&#41;</span>
	spoof_number = get_number<span style="color: black;">&#40;</span>session, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
	session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Please enter the number you would like to call.'</span><span style="color: black;">&#41;</span>
	dest_number = get_number<span style="color: black;">&#40;</span>session, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
	session.<span style="color: black;">setVariable</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;effective_caller_id_number&quot;</span>, spoof_number<span style="color: black;">&#41;</span>
&nbsp;
	session.<span style="color: black;">speak</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Calling...please wait'</span><span style="color: black;">&#41;</span>
	server = <span style="color: #dc143c;">smtplib</span>.<span style="color: black;">SMTP</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'smtp.mydomain.com'</span><span style="color: black;">&#41;</span>
&nbsp;
	fromaddr = <span style="color: #483d8b;">'freeswitch@mydomain.com'</span>
	toaddrs = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'someaddr@mydomain.com'</span><span style="color: black;">&#93;</span>
	subject = <span style="color: #483d8b;">&quot;A spoofed call was made&quot;</span>
	msg = <span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;From: %s<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>To: %s<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Subject: %s<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>fromaddr, <span style="color: #483d8b;">&quot;, &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>toaddrs<span style="color: black;">&#41;</span>, subject<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	d = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strftime</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%A, %B %d, %Y %I:%M%p'</span><span style="color: black;">&#41;</span>
	msgContents = <span style="color: #483d8b;">&quot;Date: %s<span style="color: #000099; font-weight: bold;">\n</span>Caller ID: %s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Destination Number: %s<span style="color: #000099; font-weight: bold;">\n</span>Spoofed Number: %s<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Sincerely, <span style="color: #000099; font-weight: bold;">\n</span>FreeSwitch Spoofer&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>d, session.<span style="color: black;">getVariable</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;caller_id_number&quot;</span><span style="color: black;">&#41;</span>, dest_number, spoof_number<span style="color: black;">&#41;</span>
&nbsp;
	server.<span style="color: black;">sendmail</span><span style="color: black;">&#40;</span>fromaddr, toaddrs, msg+msgContents<span style="color: black;">&#41;</span>
	session.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'transfer'</span>, dest_number<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://chrismoos.com/2009/10/16/writing-a-freeswitch-caller-id-spoofing-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
