HardwareAllTheThings/radio-frequency/limesdr-bts/index.html

2809 lines
108 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Hardware/IOT Pentesting Wiki">
<link rel="canonical" href="https://swisskyrepo.github.io/HardwareAllTheThings/radio-frequency/limesdr-bts/">
<link rel="prev" href="../../protocols/wifi/wifi-wpa/">
<link rel="next" href="../sdr/">
<link rel="icon" href="../../assets/images/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">
<title>GSM Network: LimeSDR - Hardware All The Things</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.0253249f.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.06af60db.min.css">
<style>
.social-container {
float: right;
}
</style>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../custom.css">
<script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
<meta property="og:type" content="website" >
<meta property="og:title" content="GSM Network: LimeSDR - Hardware All The Things" >
<meta property="og:description" content="Hardware/IOT Pentesting Wiki" >
<meta property="og:image" content="https://swisskyrepo.github.io/HardwareAllTheThings/assets/images/social/radio-frequency/limesdr-bts.png" >
<meta property="og:image:type" content="image/png" >
<meta property="og:image:width" content="1200" >
<meta property="og:image:height" content="630" >
<meta property="og:url" content="https://swisskyrepo.github.io/HardwareAllTheThings/radio-frequency/limesdr-bts/" >
<meta name="twitter:card" content="summary_large_image" >
<meta name="twitter:title" content="GSM Network: LimeSDR - Hardware All The Things" >
<meta name="twitter:description" content="Hardware/IOT Pentesting Wiki" >
<meta name="twitter:image" content="https://swisskyrepo.github.io/HardwareAllTheThings/assets/images/social/radio-frequency/limesdr-bts.png" >
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#gsm-network-limesdr" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="../.." title="Hardware All The Things" class="md-header__button md-logo" aria-label="Hardware All The Things" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Hardware All The Things
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
GSM Network: LimeSDR
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
</label>
</form>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<a href="javascript:void(0)" class="md-search__icon md-icon" title="Share" aria-label="Share" data-clipboard data-clipboard-text="" data-md-component="search-share" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.15c-.05.21-.08.43-.08.66 0 1.61 1.31 2.91 2.92 2.91s2.92-1.3 2.92-2.91A2.92 2.92 0 0 0 18 16.08"/></svg>
</a>
<button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
<div class="md-search__suggest" data-md-component="search-suggest"></div>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/swisskyrepo/HardwareAllTheThings" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../.." title="Hardware All The Things" class="md-nav__button md-logo" aria-label="Hardware All The Things" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
Hardware All The Things
</label>
<div class="md-nav__source">
<a href="https://github.com/swisskyrepo/HardwareAllTheThings" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg>
</div>
<div class="md-source__repository">
GitHub
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
<span class="md-ellipsis">
🔌 Hardware All The Things
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0">
<span class="md-ellipsis">
Debug interfaces
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
Debug interfaces
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../debug-interfaces/jtag/" class="md-nav__link">
<span class="md-ellipsis">
JTAG
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../debug-interfaces/swd/" class="md-nav__link">
<span class="md-ellipsis">
SWD
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../debug-interfaces/uart/" class="md-nav__link">
<span class="md-ellipsis">
UART
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
Enumeration
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Enumeration
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../enumeration/chip-identification/" class="md-nav__link">
<span class="md-ellipsis">
Chip identification
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../enumeration/fcc-id/" class="md-nav__link">
<span class="md-ellipsis">
FCC ID
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../enumeration/jtag/" class="md-nav__link">
<span class="md-ellipsis">
JTAG
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
<span class="md-ellipsis">
Firmware
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Firmware
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../firmware/firmware-dumping/" class="md-nav__link">
<span class="md-ellipsis">
Firmware Dumping
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../firmware/firmware-reverse-engineering/" class="md-nav__link">
<span class="md-ellipsis">
Firmware Reverse Engineering
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
<span class="md-ellipsis">
Gadgets
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Gadgets
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../gadgets/arduino/" class="md-nav__link">
<span class="md-ellipsis">
Arduino
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/bruschetta-board/" class="md-nav__link">
<span class="md-ellipsis">
Bruschetta
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/bus-pirate/" class="md-nav__link">
<span class="md-ellipsis">
Bus Pirate
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/ch341a/" class="md-nav__link">
<span class="md-ellipsis">
CH341A
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/esp32/" class="md-nav__link">
<span class="md-ellipsis">
ESP32
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/flipper-zero/" class="md-nav__link">
<span class="md-ellipsis">
Flipper Zero
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/goodfet/" class="md-nav__link">
<span class="md-ellipsis">
GoodFET
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/hydrabus/" class="md-nav__link">
<span class="md-ellipsis">
HydraBus
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/hydraflash/" class="md-nav__link">
<span class="md-ellipsis">
HydraFlash
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/hydranfc/" class="md-nav__link">
<span class="md-ellipsis">
HydraNFC
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/hydrausb3/" class="md-nav__link">
<span class="md-ellipsis">
HydraUSB3
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/icopy-x/" class="md-nav__link">
<span class="md-ellipsis">
iCopy-X
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/logic-analyzer/" class="md-nav__link">
<span class="md-ellipsis">
Logic Analyzer
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/m5stack/" class="md-nav__link">
<span class="md-ellipsis">
Evil M5Core2
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/memory-programmer/" class="md-nav__link">
<span class="md-ellipsis">
Memory Programmer
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/micro-bit/" class="md-nav__link">
<span class="md-ellipsis">
Micro::bit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/proxmark/" class="md-nav__link">
<span class="md-ellipsis">
Proxmark
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/pwnagotchi/" class="md-nav__link">
<span class="md-ellipsis">
Pwnagotchi
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../gadgets/raspberry-pi/" class="md-nav__link">
<span class="md-ellipsis">
Raspberry Pi
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<span class="md-ellipsis">
Other
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<span class="md-nav__icon md-icon"></span>
Other
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../other/default-iot-passwords/" class="md-nav__link">
<span class="md-ellipsis">
Default IoT Passwords
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../other/electronic-components/" class="md-nav__link">
<span class="md-ellipsis">
Electronic Components
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../other/links-and-hardware-kits/" class="md-nav__link">
<span class="md-ellipsis">
Links &amp; Hardware Kits
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<span class="md-ellipsis">
Protocols
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Protocols
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../protocols/bluetooth/" class="md-nav__link">
<span class="md-ellipsis">
Bluetooth
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/can/" class="md-nav__link">
<span class="md-ellipsis">
CAN Bus
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/dnp3/" class="md-nav__link">
<span class="md-ellipsis">
DNP3
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/gps/" class="md-nav__link">
<span class="md-ellipsis">
GPS
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/http/" class="md-nav__link">
<span class="md-ellipsis">
HTTP
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/i2c/" class="md-nav__link">
<span class="md-ellipsis">
I2C
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/lora/" class="md-nav__link">
<span class="md-ellipsis">
LoRa
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/mms/" class="md-nav__link">
<span class="md-ellipsis">
MMS (IEC 61850)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/modbus/" class="md-nav__link">
<span class="md-ellipsis">
Modbus
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/mqtt/" class="md-nav__link">
<span class="md-ellipsis">
MQTT
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/ntag215-amiibo/" class="md-nav__link">
<span class="md-ellipsis">
NFC - Amiibo
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/signaling-system-7/" class="md-nav__link">
<span class="md-ellipsis">
SS7 - Signaling System No. 7
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/spi/" class="md-nav__link">
<span class="md-ellipsis">
SPI
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/upnp/" class="md-nav__link">
<span class="md-ellipsis">
UPnP
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/usb/" class="md-nav__link">
<span class="md-ellipsis">
USB
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/zigbee/" class="md-nav__link">
<span class="md-ellipsis">
ZigBee
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_17" >
<label class="md-nav__link" for="__nav_7_17" id="__nav_7_17_label" tabindex="0">
<span class="md-ellipsis">
Rfid nfc
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_17_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7_17">
<span class="md-nav__icon md-icon"></span>
Rfid nfc
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/hf-mifare-classic/" class="md-nav__link">
<span class="md-ellipsis">
HF - Mifare Classic
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/hf-mifare-desfire/" class="md-nav__link">
<span class="md-ellipsis">
HF - Mifare DESFire
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/hf-mifare-ultralight/" class="md-nav__link">
<span class="md-ellipsis">
HF - Mifare UltraLight
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/hf-vigik/" class="md-nav__link">
<span class="md-ellipsis">
HF - Vigik
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/lf-hid-indala/" class="md-nav__link">
<span class="md-ellipsis">
LF - HID &amp; Indala
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/rfid-nfc/readme/" class="md-nav__link">
<span class="md-ellipsis">
NFC - RFID
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_18" >
<label class="md-nav__link" for="__nav_7_18" id="__nav_7_18_label" tabindex="0">
<span class="md-ellipsis">
Wifi
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_18_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7_18">
<span class="md-nav__icon md-icon"></span>
Wifi
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../protocols/wifi/wifi-basics/" class="md-nav__link">
<span class="md-ellipsis">
Wifi - Basics
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/wifi/wifi-corporate/" class="md-nav__link">
<span class="md-ellipsis">
Wifi - Enterprise Network
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/wifi/wifi-other/" class="md-nav__link">
<span class="md-ellipsis">
Wifi - Additional Tricks and Tools
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/wifi/wifi-wep/" class="md-nav__link">
<span class="md-ellipsis">
Wifi - WEP Cracking
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../protocols/wifi/wifi-wpa/" class="md-nav__link">
<span class="md-ellipsis">
Wifi - WPA Cracking
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" checked>
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<span class="md-ellipsis">
Radio frequency
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Radio frequency
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
GSM Network: LimeSDR
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
GSM Network: LimeSDR
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#running-a-gsm-station-with-osmo-network-in-a-box" class="md-nav__link">
<span class="md-ellipsis">
Running a GSM Station with osmo network-in-a-box
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#installing-the-required-packages" class="md-nav__link">
<span class="md-ellipsis">
Installing the required packages
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#updating-the-limesdr-firmware" class="md-nav__link">
<span class="md-ellipsis">
Updating the LimeSDR Firmware
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#creating-the-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
Creating the configuration files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#running-the-software-stack" class="md-nav__link">
<span class="md-ellipsis">
Running the software stack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#testing-the-base-station" class="md-nav__link">
<span class="md-ellipsis">
Testing the Base Station
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#listing-subscribers" class="md-nav__link">
<span class="md-ellipsis">
Listing Subscribers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#sending-sms" class="md-nav__link">
<span class="md-ellipsis">
Sending SMS
</span>
</a>
<nav class="md-nav" aria-label="Sending SMS">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#references" class="md-nav__link">
<span class="md-ellipsis">
References
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../sdr/" class="md-nav__link">
<span class="md-ellipsis">
SDR
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_9" >
<label class="md-nav__link" for="__nav_9" id="__nav_9_label" tabindex="0">
<span class="md-ellipsis">
Secure boot
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_9">
<span class="md-nav__icon md-icon"></span>
Secure boot
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../secure-boot/" class="md-nav__link">
<span class="md-ellipsis">
Secure Boot
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
<label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
<span class="md-ellipsis">
Side channel
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_10">
<span class="md-nav__icon md-icon"></span>
Side channel
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../side-channel/fault-injection/" class="md-nav__link">
<span class="md-ellipsis">
Fault Injection
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#running-a-gsm-station-with-osmo-network-in-a-box" class="md-nav__link">
<span class="md-ellipsis">
Running a GSM Station with osmo network-in-a-box
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#installing-the-required-packages" class="md-nav__link">
<span class="md-ellipsis">
Installing the required packages
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#updating-the-limesdr-firmware" class="md-nav__link">
<span class="md-ellipsis">
Updating the LimeSDR Firmware
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#creating-the-configuration-files" class="md-nav__link">
<span class="md-ellipsis">
Creating the configuration files
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#running-the-software-stack" class="md-nav__link">
<span class="md-ellipsis">
Running the software stack
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#testing-the-base-station" class="md-nav__link">
<span class="md-ellipsis">
Testing the Base Station
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#listing-subscribers" class="md-nav__link">
<span class="md-ellipsis">
Listing Subscribers
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#sending-sms" class="md-nav__link">
<span class="md-ellipsis">
Sending SMS
</span>
</a>
<nav class="md-nav" aria-label="Sending SMS">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#references" class="md-nav__link">
<span class="md-ellipsis">
References
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/swisskyrepo/HardwareAllTheThings/blob/main/docs/radio-frequency/limesdr-bts.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 20H6V4h7v5h5v3.1l2-2V8l-6-6H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h4zm10.2-7c.1 0 .3.1.4.2l1.3 1.3c.2.2.2.6 0 .8l-1 1-2.1-2.1 1-1c.1-.1.2-.2.4-.2m0 3.9L14.1 23H12v-2.1l6.1-6.1z"/></svg>
</a>
<a href="https://github.com/swisskyrepo/HardwareAllTheThings/raw/main/docs/radio-frequency/limesdr-bts.md" title="View source of this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 18c.56 0 1 .44 1 1s-.44 1-1 1-1-.44-1-1 .44-1 1-1m0-3c-2.73 0-5.06 1.66-6 4 .94 2.34 3.27 4 6 4s5.06-1.66 6-4c-.94-2.34-3.27-4-6-4m0 6.5a2.5 2.5 0 0 1-2.5-2.5 2.5 2.5 0 0 1 2.5-2.5 2.5 2.5 0 0 1 2.5 2.5 2.5 2.5 0 0 1-2.5 2.5M9.27 20H6V4h7v5h5v4.07c.7.08 1.36.25 2 .49V8l-6-6H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4.5a8.2 8.2 0 0 1-1.23-2"/></svg>
</a>
<h1 id="gsm-network-limesdr">GSM Network: LimeSDR</h1>
<p><strong>DISCLAIMER</strong>: This procedure is highly illegal basically anywhere in the world. Be sure to run this in a closed RF environment (also know as Faraday Cage)</p>
<ul>
<li><a href="#running-a-gsm-station-with-osmo-network-in-a-box">Running a GSM Station with osmo network-in-a-box (sms/audio)</a></li>
<li>Running a GSM Station with full osmo (sms/audio/data) [TODO]</li>
</ul>
<h3 id="running-a-gsm-station-with-osmo-network-in-a-box">Running a GSM Station with osmo network-in-a-box</h3>
<p>For this example we will use the Osmocom GSM Stack in the NITB (Network in the box) mode. In this mode the phones connected to you BTS will be able to call each other and send SMS messages. There is also the Interconnect mode in which the BSC (Base Station Controller) connects to a ISDN or IPBX (for example Asterisk) to manage the connected phones. You can check the different modes here: <a href="https://osmocom.org/projects/openbsc/wiki/OpenBSC#Configurations-Modes">https://osmocom.org/projects/openbsc/wiki/OpenBSC#Configurations-Modes</a></p>
<p>For this article I will be using a Ubuntu 18.04 LTS as operating system since there are pre-compiled packages from <a href="https://limemicro.com/">LimeMicro</a> that helps a lot. It should run in any linux distribution provided that it has the required packages and / or you compile the missing ones. I might make a tutorial later about how to install from the source code but for now I will stick to the pre-compiled packages.</p>
<h2 id="installing-the-required-packages">Installing the required packages</h2>
<p>The first thing we need to do is to install all required packages. LimeMicro did a nice work and gathered everything pre compiled in their PPAs. So lets add them first:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>sudo<span class="w"> </span>add-apt-repository<span class="w"> </span>-y<span class="w"> </span>ppa:myriadrf/drivers
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>sudo<span class="w"> </span>add-apt-repository<span class="w"> </span>-y<span class="w"> </span>ppa:myriadrf/gnuradio
</code></pre></div>
<p>Lets also add the osmocom binary builds:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>wget<span class="w"> </span>https://download.opensuse.org/repositories/network:/osmocom:/latest/xUbuntu_18.04/Release.key
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a>sudo<span class="w"> </span>apt-key<span class="w"> </span>add<span class="w"> </span>Release.key
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a>rm<span class="w"> </span>Release.key
<a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;deb [https://download.opensuse.org/repositories/network:/osmocom:/latest/xUbuntu_18.04/](https://download.opensuse.org/repositories/network:/osmocom:/latest/xUbuntu_18.04/) ./&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/etc/apt/sources.list.d/osmocom-latest.list
<a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a>sudo<span class="w"> </span>apt-get<span class="w"> </span>update
</code></pre></div>
<p>Then we can install required packages:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a>sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>osmocom-nitb<span class="w"> </span>osmo-trx-lms<span class="w"> </span>osmo-bts-trx<span class="w"> </span>limesuite
</code></pre></div>
<p>These packages are:</p>
<ul>
<li><code>osmocom-nitb</code> =&gt; Network in a Box Package. Contains all needed stuff for managing GSM Network</li>
<li><code>osmo-bts-trx</code> =&gt; The Base Transceiver Station software that manages how the network packets will be sent.</li>
<li><code>osmo-trx-lms</code> =&gt; The LimeSDR “frontend” for the BTS. This is the piece of software that actually communicates with LimeSDR</li>
<li><code>limesuite</code> =&gt; The software and driver for the LimeSDR</li>
</ul>
<h2 id="updating-the-limesdr-firmware">Updating the LimeSDR Firmware</h2>
<p>It is a good pratice to check if your LimeSDR firmware is up to date. To check and update if needed, you only need to run:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>LimeUtil<span class="w"> </span>--update
</code></pre></div>
<p>It should do everything that is needed to update</p>
<h2 id="creating-the-configuration-files">Creating the configuration files</h2>
<p>There are few files that need to be created. Lets first start with the OpenBSC config file <em>openbsc.cfg</em>:</p>
<p><div class="highlight"><pre><span></span><code><a id="__codelineno-4-1" name="__codelineno-4-1" href="#__codelineno-4-1"></a>!
<a id="__codelineno-4-2" name="__codelineno-4-2" href="#__codelineno-4-2"></a>! OpenBSC configuration saved from vty
<a id="__codelineno-4-3" name="__codelineno-4-3" href="#__codelineno-4-3"></a>! !
<a id="__codelineno-4-4" name="__codelineno-4-4" href="#__codelineno-4-4"></a>password foo
<a id="__codelineno-4-5" name="__codelineno-4-5" href="#__codelineno-4-5"></a>!
<a id="__codelineno-4-6" name="__codelineno-4-6" href="#__codelineno-4-6"></a>line vty
<a id="__codelineno-4-7" name="__codelineno-4-7" href="#__codelineno-4-7"></a> no login
<a id="__codelineno-4-8" name="__codelineno-4-8" href="#__codelineno-4-8"></a>!
<a id="__codelineno-4-9" name="__codelineno-4-9" href="#__codelineno-4-9"></a>e1_input
<a id="__codelineno-4-10" name="__codelineno-4-10" href="#__codelineno-4-10"></a> e1_line 0 driver ipa
<a id="__codelineno-4-11" name="__codelineno-4-11" href="#__codelineno-4-11"></a>network
<a id="__codelineno-4-12" name="__codelineno-4-12" href="#__codelineno-4-12"></a> network country code 901
<a id="__codelineno-4-13" name="__codelineno-4-13" href="#__codelineno-4-13"></a> mobile network code 70
<a id="__codelineno-4-14" name="__codelineno-4-14" href="#__codelineno-4-14"></a> short name HUEHUE
<a id="__codelineno-4-15" name="__codelineno-4-15" href="#__codelineno-4-15"></a> long name HUEBRNetwork
<a id="__codelineno-4-16" name="__codelineno-4-16" href="#__codelineno-4-16"></a> auth policy accept-all
<a id="__codelineno-4-17" name="__codelineno-4-17" href="#__codelineno-4-17"></a> location updating reject cause 13
<a id="__codelineno-4-18" name="__codelineno-4-18" href="#__codelineno-4-18"></a> encryption a5 0
<a id="__codelineno-4-19" name="__codelineno-4-19" href="#__codelineno-4-19"></a> neci 1
<a id="__codelineno-4-20" name="__codelineno-4-20" href="#__codelineno-4-20"></a> rrlp mode none
<a id="__codelineno-4-21" name="__codelineno-4-21" href="#__codelineno-4-21"></a> mm info 1
<a id="__codelineno-4-22" name="__codelineno-4-22" href="#__codelineno-4-22"></a> handover 0
<a id="__codelineno-4-23" name="__codelineno-4-23" href="#__codelineno-4-23"></a> handover window rxlev averaging 10
<a id="__codelineno-4-24" name="__codelineno-4-24" href="#__codelineno-4-24"></a> handover window rxqual averaging 1
<a id="__codelineno-4-25" name="__codelineno-4-25" href="#__codelineno-4-25"></a> handover window rxlev neighbor averaging 10
<a id="__codelineno-4-26" name="__codelineno-4-26" href="#__codelineno-4-26"></a> handover power budget interval 6
<a id="__codelineno-4-27" name="__codelineno-4-27" href="#__codelineno-4-27"></a> handover power budget hysteresis 3
<a id="__codelineno-4-28" name="__codelineno-4-28" href="#__codelineno-4-28"></a> handover maximum distance 9999
<a id="__codelineno-4-29" name="__codelineno-4-29" href="#__codelineno-4-29"></a> bts 0
<a id="__codelineno-4-30" name="__codelineno-4-30" href="#__codelineno-4-30"></a> type sysmobts
<a id="__codelineno-4-31" name="__codelineno-4-31" href="#__codelineno-4-31"></a> band GSM900
<a id="__codelineno-4-32" name="__codelineno-4-32" href="#__codelineno-4-32"></a> cell_identity 0
<a id="__codelineno-4-33" name="__codelineno-4-33" href="#__codelineno-4-33"></a> location_area_code 1
<a id="__codelineno-4-34" name="__codelineno-4-34" href="#__codelineno-4-34"></a> training_sequence_code 7
<a id="__codelineno-4-35" name="__codelineno-4-35" href="#__codelineno-4-35"></a> base_station_id_code 63
<a id="__codelineno-4-36" name="__codelineno-4-36" href="#__codelineno-4-36"></a> ms max power 15
<a id="__codelineno-4-37" name="__codelineno-4-37" href="#__codelineno-4-37"></a> cell reselection hysteresis 4
<a id="__codelineno-4-38" name="__codelineno-4-38" href="#__codelineno-4-38"></a> rxlev access min 0
<a id="__codelineno-4-39" name="__codelineno-4-39" href="#__codelineno-4-39"></a> channel allocator ascending
<a id="__codelineno-4-40" name="__codelineno-4-40" href="#__codelineno-4-40"></a> rach tx integer 9
<a id="__codelineno-4-41" name="__codelineno-4-41" href="#__codelineno-4-41"></a> rach max transmission 7
<a id="__codelineno-4-42" name="__codelineno-4-42" href="#__codelineno-4-42"></a> ip.access unit_id 1801 0
<a id="__codelineno-4-43" name="__codelineno-4-43" href="#__codelineno-4-43"></a> oml ip.access stream_id 255 line 0
<a id="__codelineno-4-44" name="__codelineno-4-44" href="#__codelineno-4-44"></a> gprs mode none
<a id="__codelineno-4-45" name="__codelineno-4-45" href="#__codelineno-4-45"></a> trx 0
<a id="__codelineno-4-46" name="__codelineno-4-46" href="#__codelineno-4-46"></a> rf_locked 0
<a id="__codelineno-4-47" name="__codelineno-4-47" href="#__codelineno-4-47"></a> arfcn 100
<a id="__codelineno-4-48" name="__codelineno-4-48" href="#__codelineno-4-48"></a> nominal power 23
<a id="__codelineno-4-49" name="__codelineno-4-49" href="#__codelineno-4-49"></a> max_power_red 20
<a id="__codelineno-4-50" name="__codelineno-4-50" href="#__codelineno-4-50"></a> rsl e1 tei 0
<a id="__codelineno-4-51" name="__codelineno-4-51" href="#__codelineno-4-51"></a> timeslot 0
<a id="__codelineno-4-52" name="__codelineno-4-52" href="#__codelineno-4-52"></a> phys_chan_config CCCH+SDCCH4
<a id="__codelineno-4-53" name="__codelineno-4-53" href="#__codelineno-4-53"></a> timeslot 1
<a id="__codelineno-4-54" name="__codelineno-4-54" href="#__codelineno-4-54"></a> phys_chan_config SDCCH8
<a id="__codelineno-4-55" name="__codelineno-4-55" href="#__codelineno-4-55"></a> timeslot 2
<a id="__codelineno-4-56" name="__codelineno-4-56" href="#__codelineno-4-56"></a> phys_chan_config TCH/F
<a id="__codelineno-4-57" name="__codelineno-4-57" href="#__codelineno-4-57"></a> timeslot 3
<a id="__codelineno-4-58" name="__codelineno-4-58" href="#__codelineno-4-58"></a> phys_chan_config TCH/F
<a id="__codelineno-4-59" name="__codelineno-4-59" href="#__codelineno-4-59"></a> timeslot 4
<a id="__codelineno-4-60" name="__codelineno-4-60" href="#__codelineno-4-60"></a> phys_chan_config TCH/F
<a id="__codelineno-4-61" name="__codelineno-4-61" href="#__codelineno-4-61"></a> timeslot 5
<a id="__codelineno-4-62" name="__codelineno-4-62" href="#__codelineno-4-62"></a> phys_chan_config TCH/F
<a id="__codelineno-4-63" name="__codelineno-4-63" href="#__codelineno-4-63"></a> timeslot 6
<a id="__codelineno-4-64" name="__codelineno-4-64" href="#__codelineno-4-64"></a> phys_chan_config TCH/F
<a id="__codelineno-4-65" name="__codelineno-4-65" href="#__codelineno-4-65"></a> timeslot 7
<a id="__codelineno-4-66" name="__codelineno-4-66" href="#__codelineno-4-66"></a> phys_chan_config TCH/F
</code></pre></div>
There are several parameters here, but I will only describe the ones you might want to change:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-5-1" name="__codelineno-5-1" href="#__codelineno-5-1"></a>network country code 901
<a id="__codelineno-5-2" name="__codelineno-5-2" href="#__codelineno-5-2"></a>mobile network code 70
<a id="__codelineno-5-3" name="__codelineno-5-3" href="#__codelineno-5-3"></a>short name HUEHUE
<a id="__codelineno-5-4" name="__codelineno-5-4" href="#__codelineno-5-4"></a>long name HUEBRNetwork
<a id="__codelineno-5-5" name="__codelineno-5-5" href="#__codelineno-5-5"></a>auth policy accept-all
</code></pre></div>
<ul>
<li><code>network country code</code> =&gt; That is the MCC of the network operator. It says in which country the operator is operating. For example: 724 is Brazil</li>
<li><code>mobile network code</code> =&gt; That is the MNC of the network operator. It says which network operator it is. Every mobile network operator has its own MNC (some of them have more than one).</li>
<li><code>short name</code> =&gt; The Short name of the network operator</li>
<li><code>long name</code> =&gt; The Long Name of the network operator</li>
<li><code>auth policy</code> =&gt; How we will accept the phones that are trying to connect.</li>
</ul>
<p>Be careful setting these settings specially with a <strong>accept-all</strong> policy. If you set to an existing mobile operator, any phone that is close to your LimeSDR will connect to it. The names of the operator (at least in a Android Device) only appears after connecting to it.</p>
<p>That <strong>openbsc.cfg</strong> file will be used by <strong>osmo-nitb</strong> software. The next file is <strong>osmo-bts.cfg</strong></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-6-1" name="__codelineno-6-1" href="#__codelineno-6-1"></a>!
<a id="__codelineno-6-2" name="__codelineno-6-2" href="#__codelineno-6-2"></a>! OsmoBTS configuration example
<a id="__codelineno-6-3" name="__codelineno-6-3" href="#__codelineno-6-3"></a>!!
<a id="__codelineno-6-4" name="__codelineno-6-4" href="#__codelineno-6-4"></a>!
<a id="__codelineno-6-5" name="__codelineno-6-5" href="#__codelineno-6-5"></a>log stderr
<a id="__codelineno-6-6" name="__codelineno-6-6" href="#__codelineno-6-6"></a> logging color 1
<a id="__codelineno-6-7" name="__codelineno-6-7" href="#__codelineno-6-7"></a> logging timestamp 0
<a id="__codelineno-6-8" name="__codelineno-6-8" href="#__codelineno-6-8"></a> logging level rsl notice
<a id="__codelineno-6-9" name="__codelineno-6-9" href="#__codelineno-6-9"></a> logging level oml notice
<a id="__codelineno-6-10" name="__codelineno-6-10" href="#__codelineno-6-10"></a> logging level rll notice
<a id="__codelineno-6-11" name="__codelineno-6-11" href="#__codelineno-6-11"></a> logging level rr notice
<a id="__codelineno-6-12" name="__codelineno-6-12" href="#__codelineno-6-12"></a> logging level loop debug
<a id="__codelineno-6-13" name="__codelineno-6-13" href="#__codelineno-6-13"></a> logging level meas debug
<a id="__codelineno-6-14" name="__codelineno-6-14" href="#__codelineno-6-14"></a> logging level pag error
<a id="__codelineno-6-15" name="__codelineno-6-15" href="#__codelineno-6-15"></a> logging level l1c error
<a id="__codelineno-6-16" name="__codelineno-6-16" href="#__codelineno-6-16"></a> logging level l1p error
<a id="__codelineno-6-17" name="__codelineno-6-17" href="#__codelineno-6-17"></a> logging level dsp error
<a id="__codelineno-6-18" name="__codelineno-6-18" href="#__codelineno-6-18"></a> logging level abis error
<a id="__codelineno-6-19" name="__codelineno-6-19" href="#__codelineno-6-19"></a>
<a id="__codelineno-6-20" name="__codelineno-6-20" href="#__codelineno-6-20"></a>!
<a id="__codelineno-6-21" name="__codelineno-6-21" href="#__codelineno-6-21"></a>line vty
<a id="__codelineno-6-22" name="__codelineno-6-22" href="#__codelineno-6-22"></a> no login
<a id="__codelineno-6-23" name="__codelineno-6-23" href="#__codelineno-6-23"></a>!
<a id="__codelineno-6-24" name="__codelineno-6-24" href="#__codelineno-6-24"></a>phy 0
<a id="__codelineno-6-25" name="__codelineno-6-25" href="#__codelineno-6-25"></a> instance 0
<a id="__codelineno-6-26" name="__codelineno-6-26" href="#__codelineno-6-26"></a> osmotrx rx-gain 40
<a id="__codelineno-6-27" name="__codelineno-6-27" href="#__codelineno-6-27"></a> osmotrx tx-attenuation 50
<a id="__codelineno-6-28" name="__codelineno-6-28" href="#__codelineno-6-28"></a> osmotrx ip local 127.0.0.1
<a id="__codelineno-6-29" name="__codelineno-6-29" href="#__codelineno-6-29"></a> osmotrx ip remote 127.0.0.1
<a id="__codelineno-6-30" name="__codelineno-6-30" href="#__codelineno-6-30"></a> no osmotrx timing-advance-loop
<a id="__codelineno-6-31" name="__codelineno-6-31" href="#__codelineno-6-31"></a>bts 0
<a id="__codelineno-6-32" name="__codelineno-6-32" href="#__codelineno-6-32"></a> oml remote-ip 127.0.0.1
<a id="__codelineno-6-33" name="__codelineno-6-33" href="#__codelineno-6-33"></a> ipa unit-id 1801 0
<a id="__codelineno-6-34" name="__codelineno-6-34" href="#__codelineno-6-34"></a> gsmtap-sapi pdtch
<a id="__codelineno-6-35" name="__codelineno-6-35" href="#__codelineno-6-35"></a> gsmtap-sapi ccch
<a id="__codelineno-6-36" name="__codelineno-6-36" href="#__codelineno-6-36"></a> band 900
<a id="__codelineno-6-37" name="__codelineno-6-37" href="#__codelineno-6-37"></a> trx 0
<a id="__codelineno-6-38" name="__codelineno-6-38" href="#__codelineno-6-38"></a> phy 0 instance 0
</code></pre></div>
<p>The only importante parameter here to take care is <strong>band</strong>. Make sure is the same as in <em>openbsc.cfg</em> file. The next one is <em>osmo-trx.cfg</em> which will be used by <em>osmo-trx-lms:</em></p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-7-1" name="__codelineno-7-1" href="#__codelineno-7-1"></a>log stderr
<a id="__codelineno-7-2" name="__codelineno-7-2" href="#__codelineno-7-2"></a> logging filter all 1
<a id="__codelineno-7-3" name="__codelineno-7-3" href="#__codelineno-7-3"></a> logging color 1
<a id="__codelineno-7-4" name="__codelineno-7-4" href="#__codelineno-7-4"></a> logging print category 1
<a id="__codelineno-7-5" name="__codelineno-7-5" href="#__codelineno-7-5"></a> logging timestamp 1
<a id="__codelineno-7-6" name="__codelineno-7-6" href="#__codelineno-7-6"></a> logging print file basename
<a id="__codelineno-7-7" name="__codelineno-7-7" href="#__codelineno-7-7"></a> logging level set-all info
<a id="__codelineno-7-8" name="__codelineno-7-8" href="#__codelineno-7-8"></a>!
<a id="__codelineno-7-9" name="__codelineno-7-9" href="#__codelineno-7-9"></a>line vty
<a id="__codelineno-7-10" name="__codelineno-7-10" href="#__codelineno-7-10"></a> no login
<a id="__codelineno-7-11" name="__codelineno-7-11" href="#__codelineno-7-11"></a>!
<a id="__codelineno-7-12" name="__codelineno-7-12" href="#__codelineno-7-12"></a>trx
<a id="__codelineno-7-13" name="__codelineno-7-13" href="#__codelineno-7-13"></a> bind-ip 127.0.0.1
<a id="__codelineno-7-14" name="__codelineno-7-14" href="#__codelineno-7-14"></a> remote-ip 127.0.0.1
<a id="__codelineno-7-15" name="__codelineno-7-15" href="#__codelineno-7-15"></a> base-port 5700
<a id="__codelineno-7-16" name="__codelineno-7-16" href="#__codelineno-7-16"></a> egprs disable
<a id="__codelineno-7-17" name="__codelineno-7-17" href="#__codelineno-7-17"></a> tx-sps 4
<a id="__codelineno-7-18" name="__codelineno-7-18" href="#__codelineno-7-18"></a> rx-sps 4
<a id="__codelineno-7-19" name="__codelineno-7-19" href="#__codelineno-7-19"></a> rt-prio 18
<a id="__codelineno-7-20" name="__codelineno-7-20" href="#__codelineno-7-20"></a> chan 0
<a id="__codelineno-7-21" name="__codelineno-7-21" href="#__codelineno-7-21"></a> tx-path BAND1
<a id="__codelineno-7-22" name="__codelineno-7-22" href="#__codelineno-7-22"></a> rx-path LNAW
</code></pre></div>
<p>There are not much to change here. If youre using a multi-port LimeSDR (like LimeSDR USB or PCIe) you can change the parameter <em>tx-path</em> and <em>rx-path </em>to the desired paths.</p>
<h2 id="running-the-software-stack">Running the software stack</h2>
<p>There are a few programs to run to get the BTS working. You should run all of them from the folder you created the configuration files.</p>
<p>The first one we should run is osmo-trx-lms . This one should be ran as root to enable high priority scheduling (specially needed if youre running a small SBC like a Raspberry PI).</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a>sudo<span class="w"> </span>osmo-trx-lms
</code></pre></div>
<p><img alt="OSMO TRX LMS running" src="../../assets/limebts/1_KbNtmYsmaCMVJinWnJdhFg.jpg" /></p>
<p>The second one is the osmo-nitb which is the base station controller. This one doesnt need to be ran as root.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a>osmo-nitb
</code></pre></div>
<p><img alt="Osmo NITB running" src="../../assets/limebts/1_MmIJlBChAK1XF8TzxoX80g.jpg" /></p>
<p>And the last software is the osmo-bts-trx which handles the transceiver:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-10-1" name="__codelineno-10-1" href="#__codelineno-10-1"></a>osmo-bts-trx
</code></pre></div>
<p><img alt="Osmo BTS TRX running" src="../../assets/limebts/1_2il3cVVy8yFsX5hNsESyDw.jpg" /></p>
<p>Now your base station should be running.</p>
<h2 id="testing-the-base-station">Testing the Base Station</h2>
<p>The best way to test is to have a custom simcard like this one:</p>
<p><img alt="Sysmocom Custom Simcard http://shop.sysmocom.de/products/sysmousim-sjs1-4ff" src="../../assets/limebts/0_pKv_npHA_3DhtIQi.jpg" /></p>
<p>But since we set the BTS to <em>accept-all</em> mode, you can just go to your phone network settings and select the created network. That will work fine if you have an Android phone which allows you to select custom networks:</p>
<p><img alt="List of networks in an Android Phone. Here the 72470 network I just created" src="../../assets/limebts/1_8_tklU4IBXyxERiyDkxl-w.jpg" /></p>
<p>Here is the network I just created with MCC 724 and MNC 70. In some simcards it is required that the MCC is the same as sim country (for example here it only shows if the network is at 724).</p>
<p>After connecting to the network, the name should appear instead of the MCC+MNC code:</p>
<p><img alt="HUEBRNetwork showing in the list" src="../../assets/limebts/1_CrDQk7YysiFXzgaOrxaTQA.jpg" /></p>
<h2 id="listing-subscribers">Listing Subscribers</h2>
<p>There is a simple python script to list the subscribers. What it does is to open the sqlite database and do a simple query and print.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-11-1" name="__codelineno-11-1" href="#__codelineno-11-1"></a><span class="ch">#!/usr/bin/env python</span>
<a id="__codelineno-11-2" name="__codelineno-11-2" href="#__codelineno-11-2"></a><span class="kn">import</span> <span class="nn">sqlite3</span>
<a id="__codelineno-11-3" name="__codelineno-11-3" href="#__codelineno-11-3"></a>
<a id="__codelineno-11-4" name="__codelineno-11-4" href="#__codelineno-11-4"></a><span class="n">HLR_DATABASE</span> <span class="o">=</span> <span class="s2">&quot;hlr.sqlite3&quot;</span>
<a id="__codelineno-11-5" name="__codelineno-11-5" href="#__codelineno-11-5"></a><span class="n">db</span> <span class="o">=</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">HLR_DATABASE</span><span class="p">)</span>
<a id="__codelineno-11-6" name="__codelineno-11-6" href="#__codelineno-11-6"></a><span class="n">c</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<a id="__codelineno-11-7" name="__codelineno-11-7" href="#__codelineno-11-7"></a><span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;SELECT * FROM Subscriber&quot;</span><span class="p">)</span>
<a id="__codelineno-11-8" name="__codelineno-11-8" href="#__codelineno-11-8"></a>
<a id="__codelineno-11-9" name="__codelineno-11-9" href="#__codelineno-11-9"></a><span class="nb">print</span> <span class="s2">&quot;ID</span><span class="se">\t\t</span><span class="s2">created</span><span class="se">\t\t</span><span class="s2">IMSI</span><span class="se">\t\t\t</span><span class="s2">TMSI</span><span class="se">\t\t</span><span class="s2">extension</span><span class="se">\n</span><span class="s2">&quot;</span>
<a id="__codelineno-11-10" name="__codelineno-11-10" href="#__codelineno-11-10"></a><span class="k">while</span> <span class="mi">1</span><span class="p">:</span>
<a id="__codelineno-11-11" name="__codelineno-11-11" href="#__codelineno-11-11"></a> <span class="n">subscriber</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">fetchone</span><span class="p">()</span>
<a id="__codelineno-11-12" name="__codelineno-11-12" href="#__codelineno-11-12"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">subscriber</span><span class="p">:</span>
<a id="__codelineno-11-13" name="__codelineno-11-13" href="#__codelineno-11-13"></a> <span class="k">break</span>
<a id="__codelineno-11-14" name="__codelineno-11-14" href="#__codelineno-11-14"></a>
<a id="__codelineno-11-15" name="__codelineno-11-15" href="#__codelineno-11-15"></a> <span class="nb">print</span> <span class="s2">&quot;</span><span class="si">{0:1}</span><span class="se">\t</span><span class="si">{1:2}</span><span class="se">\t</span><span class="si">{2:&lt;15}</span><span class="se">\t\t</span><span class="si">{3:&lt;10}</span><span class="se">\t</span><span class="si">{4}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<a id="__codelineno-11-16" name="__codelineno-11-16" href="#__codelineno-11-16"></a> <span class="n">subscriber</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
<a id="__codelineno-11-17" name="__codelineno-11-17" href="#__codelineno-11-17"></a> <span class="n">subscriber</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
<a id="__codelineno-11-18" name="__codelineno-11-18" href="#__codelineno-11-18"></a> <span class="n">subscriber</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span>
<a id="__codelineno-11-19" name="__codelineno-11-19" href="#__codelineno-11-19"></a> <span class="n">subscriber</span><span class="p">[</span><span class="mi">7</span><span class="p">],</span>
<a id="__codelineno-11-20" name="__codelineno-11-20" href="#__codelineno-11-20"></a> <span class="n">subscriber</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span>
<a id="__codelineno-11-21" name="__codelineno-11-21" href="#__codelineno-11-21"></a> <span class="p">)</span>
<a id="__codelineno-11-22" name="__codelineno-11-22" href="#__codelineno-11-22"></a>
<a id="__codelineno-11-23" name="__codelineno-11-23" href="#__codelineno-11-23"></a><span class="n">db</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</code></pre></div>
<p>The IMSI field is unique to that phone / simcard combination. Thats the number you can use to track a specific user around the world. The extension is the assigned phone number for that specific phone.</p>
<h2 id="sending-sms">Sending SMS</h2>
<p>There are two scripts I found in the internet to send SMS. They basically selects the IMSI from the sqlite database the Osmo stack creates and then connects through the telnet interface to issue the desired commands. One of them is <em>sms_broadcast.py</em>:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-12-1" name="__codelineno-12-1" href="#__codelineno-12-1"></a><span class="ch">#!/usr/bin/env python</span>
<a id="__codelineno-12-2" name="__codelineno-12-2" href="#__codelineno-12-2"></a><span class="kn">import</span> <span class="nn">telnetlib</span>
<a id="__codelineno-12-3" name="__codelineno-12-3" href="#__codelineno-12-3"></a><span class="kn">import</span> <span class="nn">sqlite3</span>
<a id="__codelineno-12-4" name="__codelineno-12-4" href="#__codelineno-12-4"></a><span class="kn">import</span> <span class="nn">sys</span>
<a id="__codelineno-12-5" name="__codelineno-12-5" href="#__codelineno-12-5"></a>
<a id="__codelineno-12-6" name="__codelineno-12-6" href="#__codelineno-12-6"></a><span class="n">imsi</span> <span class="o">=</span> <span class="mi">999999999999999</span>
<a id="__codelineno-12-7" name="__codelineno-12-7" href="#__codelineno-12-7"></a><span class="n">HLR_DATABASE</span> <span class="o">=</span> <span class="s2">&quot;hlr.sqlite3&quot;</span>
<a id="__codelineno-12-8" name="__codelineno-12-8" href="#__codelineno-12-8"></a>
<a id="__codelineno-12-9" name="__codelineno-12-9" href="#__codelineno-12-9"></a><span class="k">def</span> <span class="nf">check_extension</span><span class="p">(</span><span class="n">extension</span><span class="p">):</span>
<a id="__codelineno-12-10" name="__codelineno-12-10" href="#__codelineno-12-10"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;show subscriber extension </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-12-11" name="__codelineno-12-11" href="#__codelineno-12-11"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-12" name="__codelineno-12-12" href="#__codelineno-12-12"></a>
<a id="__codelineno-12-13" name="__codelineno-12-13" href="#__codelineno-12-13"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;No subscriber found for extension&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-12-14" name="__codelineno-12-14" href="#__codelineno-12-14"></a> <span class="n">create_subscriber</span><span class="p">(</span><span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-12-15" name="__codelineno-12-15" href="#__codelineno-12-15"></a>
<a id="__codelineno-12-16" name="__codelineno-12-16" href="#__codelineno-12-16"></a><span class="k">def</span> <span class="nf">create_subscriber</span><span class="p">(</span><span class="n">extension</span><span class="p">):</span>
<a id="__codelineno-12-17" name="__codelineno-12-17" href="#__codelineno-12-17"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;No user with excension </span><span class="si">%s</span><span class="s2"> found. Creating new...&quot;</span> <span class="o">%</span> <span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-12-18" name="__codelineno-12-18" href="#__codelineno-12-18"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Extension: </span><span class="si">%s</span><span class="s2">, IMSI: </span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">extension</span><span class="p">,</span> <span class="n">imsi</span><span class="p">))</span>
<a id="__codelineno-12-19" name="__codelineno-12-19" href="#__codelineno-12-19"></a>
<a id="__codelineno-12-20" name="__codelineno-12-20" href="#__codelineno-12-20"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;show subscriber imsi </span><span class="si">%d</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">imsi</span><span class="p">)</span>
<a id="__codelineno-12-21" name="__codelineno-12-21" href="#__codelineno-12-21"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-22" name="__codelineno-12-22" href="#__codelineno-12-22"></a>
<a id="__codelineno-12-23" name="__codelineno-12-23" href="#__codelineno-12-23"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;No subscriber found for imsi&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-12-24" name="__codelineno-12-24" href="#__codelineno-12-24"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber create imsi </span><span class="si">%d</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">imsi</span><span class="p">)</span>
<a id="__codelineno-12-25" name="__codelineno-12-25" href="#__codelineno-12-25"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-26" name="__codelineno-12-26" href="#__codelineno-12-26"></a>
<a id="__codelineno-12-27" name="__codelineno-12-27" href="#__codelineno-12-27"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;enable</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<a id="__codelineno-12-28" name="__codelineno-12-28" href="#__codelineno-12-28"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC# &quot;</span><span class="p">)</span>
<a id="__codelineno-12-29" name="__codelineno-12-29" href="#__codelineno-12-29"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber imsi </span><span class="si">%d</span><span class="s2"> extension </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">imsi</span><span class="p">,</span> <span class="n">extension</span><span class="p">))</span>
<a id="__codelineno-12-30" name="__codelineno-12-30" href="#__codelineno-12-30"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC# &quot;</span><span class="p">)</span>
<a id="__codelineno-12-31" name="__codelineno-12-31" href="#__codelineno-12-31"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;disable</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<a id="__codelineno-12-32" name="__codelineno-12-32" href="#__codelineno-12-32"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-33" name="__codelineno-12-33" href="#__codelineno-12-33"></a>
<a id="__codelineno-12-34" name="__codelineno-12-34" href="#__codelineno-12-34"></a><span class="k">def</span> <span class="nf">get_users</span><span class="p">():</span>
<a id="__codelineno-12-35" name="__codelineno-12-35" href="#__codelineno-12-35"></a> <span class="c1"># returns user id list generator</span>
<a id="__codelineno-12-36" name="__codelineno-12-36" href="#__codelineno-12-36"></a>
<a id="__codelineno-12-37" name="__codelineno-12-37" href="#__codelineno-12-37"></a> <span class="n">db</span> <span class="o">=</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">HLR_DATABASE</span><span class="p">)</span>
<a id="__codelineno-12-38" name="__codelineno-12-38" href="#__codelineno-12-38"></a> <span class="n">c</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<a id="__codelineno-12-39" name="__codelineno-12-39" href="#__codelineno-12-39"></a> <span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s2">&quot;SELECT * FROM Subscriber&quot;</span><span class="p">)</span>
<a id="__codelineno-12-40" name="__codelineno-12-40" href="#__codelineno-12-40"></a>
<a id="__codelineno-12-41" name="__codelineno-12-41" href="#__codelineno-12-41"></a> <span class="k">for</span> <span class="n">subscriber</span> <span class="ow">in</span> <span class="n">c</span><span class="o">.</span><span class="n">fetchall</span><span class="p">():</span>
<a id="__codelineno-12-42" name="__codelineno-12-42" href="#__codelineno-12-42"></a> <span class="k">yield</span> <span class="n">subscriber</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<a id="__codelineno-12-43" name="__codelineno-12-43" href="#__codelineno-12-43"></a>
<a id="__codelineno-12-44" name="__codelineno-12-44" href="#__codelineno-12-44"></a><span class="k">def</span> <span class="nf">send_sms</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">extension</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
<a id="__codelineno-12-45" name="__codelineno-12-45" href="#__codelineno-12-45"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber id </span><span class="si">%d</span><span class="s2"> sms sender extension </span><span class="si">%s</span><span class="s2"> send </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">extension</span><span class="p">,</span> <span class="n">message</span><span class="p">))</span>
<a id="__codelineno-12-46" name="__codelineno-12-46" href="#__codelineno-12-46"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-47" name="__codelineno-12-47" href="#__codelineno-12-47"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;%&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-12-48" name="__codelineno-12-48" href="#__codelineno-12-48"></a> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
<a id="__codelineno-12-49" name="__codelineno-12-49" href="#__codelineno-12-49"></a> <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="__codelineno-12-50" name="__codelineno-12-50" href="#__codelineno-12-50"></a>
<a id="__codelineno-12-51" name="__codelineno-12-51" href="#__codelineno-12-51"></a><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<a id="__codelineno-12-52" name="__codelineno-12-52" href="#__codelineno-12-52"></a> <span class="k">try</span><span class="p">:</span>
<a id="__codelineno-12-53" name="__codelineno-12-53" href="#__codelineno-12-53"></a> <span class="n">extension</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<a id="__codelineno-12-54" name="__codelineno-12-54" href="#__codelineno-12-54"></a> <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">:])</span>
<a id="__codelineno-12-55" name="__codelineno-12-55" href="#__codelineno-12-55"></a> <span class="k">except</span><span class="p">:</span>
<a id="__codelineno-12-56" name="__codelineno-12-56" href="#__codelineno-12-56"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;usage: ./sms_broadcast.py extension message&quot;</span><span class="p">)</span>
<a id="__codelineno-12-57" name="__codelineno-12-57" href="#__codelineno-12-57"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;This script sends a message from the specified extension (number) to all devices connected to this base station&quot;</span><span class="p">)</span>
<a id="__codelineno-12-58" name="__codelineno-12-58" href="#__codelineno-12-58"></a> <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="__codelineno-12-59" name="__codelineno-12-59" href="#__codelineno-12-59"></a>
<a id="__codelineno-12-60" name="__codelineno-12-60" href="#__codelineno-12-60"></a> <span class="n">conn</span> <span class="o">=</span> <span class="n">telnetlib</span><span class="o">.</span><span class="n">Telnet</span><span class="p">(</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="mi">4242</span><span class="p">)</span>
<a id="__codelineno-12-61" name="__codelineno-12-61" href="#__codelineno-12-61"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-12-62" name="__codelineno-12-62" href="#__codelineno-12-62"></a>
<a id="__codelineno-12-63" name="__codelineno-12-63" href="#__codelineno-12-63"></a> <span class="n">check_extension</span><span class="p">(</span><span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-12-64" name="__codelineno-12-64" href="#__codelineno-12-64"></a>
<a id="__codelineno-12-65" name="__codelineno-12-65" href="#__codelineno-12-65"></a> <span class="k">for</span> <span class="nb">id</span> <span class="ow">in</span> <span class="n">get_users</span><span class="p">():</span>
<a id="__codelineno-12-66" name="__codelineno-12-66" href="#__codelineno-12-66"></a> <span class="n">send_sms</span><span class="p">(</span><span class="nb">id</span><span class="p">,</span> <span class="n">extension</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>
</code></pre></div>
<p>This one is pretty simple to use:</p>
<p><div class="highlight"><pre><span></span><code><a id="__codelineno-13-1" name="__codelineno-13-1" href="#__codelineno-13-1"></a>python<span class="w"> </span>sms_broadcast.py<span class="w"> </span><span class="s2">&quot;source number&quot;</span><span class="w"> </span><span class="s2">&quot;message&quot;</span>
</code></pre></div>
This will send an SMS to <strong>all</strong> connected devices as it was the <em>source number</em>.</p>
<p>Another option is to target a single user:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-14-1" name="__codelineno-14-1" href="#__codelineno-14-1"></a><span class="ch">#!/usr/bin/env python</span>
<a id="__codelineno-14-2" name="__codelineno-14-2" href="#__codelineno-14-2"></a><span class="kn">import</span> <span class="nn">telnetlib</span>
<a id="__codelineno-14-3" name="__codelineno-14-3" href="#__codelineno-14-3"></a><span class="kn">import</span> <span class="nn">sys</span>
<a id="__codelineno-14-4" name="__codelineno-14-4" href="#__codelineno-14-4"></a><span class="kn">import</span> <span class="nn">random</span>
<a id="__codelineno-14-5" name="__codelineno-14-5" href="#__codelineno-14-5"></a><span class="kn">import</span> <span class="nn">time</span>
<a id="__codelineno-14-6" name="__codelineno-14-6" href="#__codelineno-14-6"></a>
<a id="__codelineno-14-7" name="__codelineno-14-7" href="#__codelineno-14-7"></a><span class="n">imsi</span> <span class="o">=</span> <span class="mi">999999999999999</span>
<a id="__codelineno-14-8" name="__codelineno-14-8" href="#__codelineno-14-8"></a>
<a id="__codelineno-14-9" name="__codelineno-14-9" href="#__codelineno-14-9"></a><span class="k">def</span> <span class="nf">check_extension</span><span class="p">(</span><span class="n">extension</span><span class="p">):</span>
<a id="__codelineno-14-10" name="__codelineno-14-10" href="#__codelineno-14-10"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;show subscriber extension </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-14-11" name="__codelineno-14-11" href="#__codelineno-14-11"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-14-12" name="__codelineno-14-12" href="#__codelineno-14-12"></a>
<a id="__codelineno-14-13" name="__codelineno-14-13" href="#__codelineno-14-13"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;No subscriber found for extension&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-14-14" name="__codelineno-14-14" href="#__codelineno-14-14"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Phone with extension </span><span class="si">%s</span><span class="s2"> not found ;(&quot;</span> <span class="o">%</span> <span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-14-15" name="__codelineno-14-15" href="#__codelineno-14-15"></a> <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="__codelineno-14-16" name="__codelineno-14-16" href="#__codelineno-14-16"></a>
<a id="__codelineno-14-17" name="__codelineno-14-17" href="#__codelineno-14-17"></a><span class="k">def</span> <span class="nf">check_spam_subscriber</span><span class="p">():</span>
<a id="__codelineno-14-18" name="__codelineno-14-18" href="#__codelineno-14-18"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;show subscriber imsi </span><span class="si">%d</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">imsi</span><span class="p">)</span>
<a id="__codelineno-14-19" name="__codelineno-14-19" href="#__codelineno-14-19"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-14-20" name="__codelineno-14-20" href="#__codelineno-14-20"></a>
<a id="__codelineno-14-21" name="__codelineno-14-21" href="#__codelineno-14-21"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;No subscriber found for imsi&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-14-22" name="__codelineno-14-22" href="#__codelineno-14-22"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber create imsi </span><span class="si">%d</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">imsi</span><span class="p">)</span>
<a id="__codelineno-14-23" name="__codelineno-14-23" href="#__codelineno-14-23"></a> <span class="nb">print</span><span class="p">(</span><span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">))</span>
<a id="__codelineno-14-24" name="__codelineno-14-24" href="#__codelineno-14-24"></a>
<a id="__codelineno-14-25" name="__codelineno-14-25" href="#__codelineno-14-25"></a><span class="k">def</span> <span class="nf">send</span><span class="p">(</span><span class="n">extension</span><span class="p">,</span> <span class="n">spam_number</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
<a id="__codelineno-14-26" name="__codelineno-14-26" href="#__codelineno-14-26"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Sending sms from </span><span class="si">%d</span><span class="s2">...&quot;</span> <span class="o">%</span> <span class="n">spam_number</span><span class="p">)</span>
<a id="__codelineno-14-27" name="__codelineno-14-27" href="#__codelineno-14-27"></a>
<a id="__codelineno-14-28" name="__codelineno-14-28" href="#__codelineno-14-28"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;enable</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<a id="__codelineno-14-29" name="__codelineno-14-29" href="#__codelineno-14-29"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC# &quot;</span><span class="p">)</span>
<a id="__codelineno-14-30" name="__codelineno-14-30" href="#__codelineno-14-30"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber imsi </span><span class="si">%d</span><span class="s2"> extension </span><span class="si">%d</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">imsi</span><span class="p">,</span> <span class="n">spam_number</span><span class="p">))</span>
<a id="__codelineno-14-31" name="__codelineno-14-31" href="#__codelineno-14-31"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC# &quot;</span><span class="p">)</span>
<a id="__codelineno-14-32" name="__codelineno-14-32" href="#__codelineno-14-32"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;disable</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<a id="__codelineno-14-33" name="__codelineno-14-33" href="#__codelineno-14-33"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-14-34" name="__codelineno-14-34" href="#__codelineno-14-34"></a>
<a id="__codelineno-14-35" name="__codelineno-14-35" href="#__codelineno-14-35"></a> <span class="n">conn</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;subscriber extension </span><span class="si">%s</span><span class="s2"> sms sender extension </span><span class="si">%d</span><span class="s2"> send </span><span class="si">%s</span><span class="se">\n</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">extension</span><span class="p">,</span> <span class="n">spam_number</span><span class="p">,</span> <span class="n">message</span><span class="p">))</span>
<a id="__codelineno-14-36" name="__codelineno-14-36" href="#__codelineno-14-36"></a> <span class="n">res</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-14-37" name="__codelineno-14-37" href="#__codelineno-14-37"></a>
<a id="__codelineno-14-38" name="__codelineno-14-38" href="#__codelineno-14-38"></a> <span class="k">if</span> <span class="sa">b</span><span class="s2">&quot;%&quot;</span> <span class="ow">in</span> <span class="n">res</span><span class="p">:</span>
<a id="__codelineno-14-39" name="__codelineno-14-39" href="#__codelineno-14-39"></a> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
<a id="__codelineno-14-40" name="__codelineno-14-40" href="#__codelineno-14-40"></a> <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="__codelineno-14-41" name="__codelineno-14-41" href="#__codelineno-14-41"></a>
<a id="__codelineno-14-42" name="__codelineno-14-42" href="#__codelineno-14-42"></a><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<a id="__codelineno-14-43" name="__codelineno-14-43" href="#__codelineno-14-43"></a> <span class="k">try</span><span class="p">:</span>
<a id="__codelineno-14-44" name="__codelineno-14-44" href="#__codelineno-14-44"></a> <span class="n">extension</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<a id="__codelineno-14-45" name="__codelineno-14-45" href="#__codelineno-14-45"></a> <span class="n">repeats</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
<a id="__codelineno-14-46" name="__codelineno-14-46" href="#__codelineno-14-46"></a> <span class="n">message</span> <span class="o">=</span> <span class="s2">&quot; &quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">3</span><span class="p">:])</span>
<a id="__codelineno-14-47" name="__codelineno-14-47" href="#__codelineno-14-47"></a> <span class="k">except</span><span class="p">:</span>
<a id="__codelineno-14-48" name="__codelineno-14-48" href="#__codelineno-14-48"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;usage: ./sms_spam.py extension [num of repeats] message&quot;</span><span class="p">)</span>
<a id="__codelineno-14-49" name="__codelineno-14-49" href="#__codelineno-14-49"></a> <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;This script sends a message to specified number&quot;</span><span class="p">)</span>
<a id="__codelineno-14-50" name="__codelineno-14-50" href="#__codelineno-14-50"></a> <span class="n">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<a id="__codelineno-14-51" name="__codelineno-14-51" href="#__codelineno-14-51"></a>
<a id="__codelineno-14-52" name="__codelineno-14-52" href="#__codelineno-14-52"></a> <span class="n">conn</span> <span class="o">=</span> <span class="n">telnetlib</span><span class="o">.</span><span class="n">Telnet</span><span class="p">(</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="mi">4242</span><span class="p">)</span>
<a id="__codelineno-14-53" name="__codelineno-14-53" href="#__codelineno-14-53"></a> <span class="n">conn</span><span class="o">.</span><span class="n">read_until</span><span class="p">(</span><span class="sa">b</span><span class="s2">&quot;OpenBSC&gt; &quot;</span><span class="p">)</span>
<a id="__codelineno-14-54" name="__codelineno-14-54" href="#__codelineno-14-54"></a>
<a id="__codelineno-14-55" name="__codelineno-14-55" href="#__codelineno-14-55"></a> <span class="n">check_extension</span><span class="p">(</span><span class="n">extension</span><span class="p">)</span>
<a id="__codelineno-14-56" name="__codelineno-14-56" href="#__codelineno-14-56"></a> <span class="n">check_spam_subscriber</span><span class="p">()</span>
<a id="__codelineno-14-57" name="__codelineno-14-57" href="#__codelineno-14-57"></a>
<a id="__codelineno-14-58" name="__codelineno-14-58" href="#__codelineno-14-58"></a> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">repeats</span><span class="p">):</span>
<a id="__codelineno-14-59" name="__codelineno-14-59" href="#__codelineno-14-59"></a> <span class="n">spam_number</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1000</span><span class="p">,</span><span class="mi">9999</span><span class="p">)</span>
<a id="__codelineno-14-60" name="__codelineno-14-60" href="#__codelineno-14-60"></a> <span class="n">send</span><span class="p">(</span><span class="n">extension</span><span class="p">,</span> <span class="n">spam_number</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>
<a id="__codelineno-14-61" name="__codelineno-14-61" href="#__codelineno-14-61"></a> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
</code></pre></div>
<p>This one generates a random source number and sends the specified message <strong>n</strong> times.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-15-1" name="__codelineno-15-1" href="#__codelineno-15-1"></a>python<span class="w"> </span>sms_spam.py<span class="w"> </span><span class="s2">&quot;target number&quot;</span><span class="w"> </span><span class="s2">&quot;number of times&quot;</span><span class="w"> </span><span class="s2">&quot;message&quot;</span>
</code></pre></div>
<h3 id="references">References</h3>
<ul>
<li><a href="https://lucasteske.dev/2019/12/creating-your-own-gsm-network-with-limesdr/">Creating your own GSM Network with LimeSDR</a></li>
<li><a href="https://osmocom.org/projects/openbsc/wiki/OpenBSC#Configurations-Modes">OpenBSC: Configuration Modes</a></li>
<li><a href="https://ftp.osmocom.org/docs/latest/osmobsc-vty-reference.pdf">osmobsc vty reference</a></li>
<li><a href="https://limemicro.com/">LimeSDR</a></li>
<li><a href="http://shop.sysmocom.de/products/sysmousim-sjs1-4ff">Sysmocom Custom Simcard</a></li>
</ul>
<aside class="md-source-file">
<span class="md-source-file__fact">
<span class="md-icon" title="Last update">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg>
</span>
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">November 13, 2024</span>
</span>
</aside>
<div class="social-container">
<b>Share this content</b>
<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
<a class="a2a_dd" href="https://www.addtoany.com/share"></a>
<a class="a2a_button_x"></a>
<a class="a2a_button_telegram"></a>
<a class="a2a_button_linkedin"></a>
<a class="a2a_button_email"></a>
<a class="a2a_button_microsoft_teams"></a>
</div>
<br>
<script async src="https://static.addtoany.com/menu/page.js"></script>
<script defer src="https://cloud.umami.is/script.js" data-website-id="49aad71c-7d98-4635-8bd5-b6799c8874f8"></script>
</div>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
<button type="button" class="md-top md-icon" data-md-component="top" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg>
Back to top
</button>
</main>
<footer class="md-footer">
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../..", "features": ["content.code.copy", "content.action.edit", "content.action.view", "content.tooltips", "navigation.tracking", "navigation.top", "search.share", "search.suggest"], "search": "../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
<script src="../../assets/javascripts/bundle.83f73b43.min.js"></script>
</body>
</html>