Advertisement
Brandan

OR911 Backend import

Nov 13th, 2014
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 6.88 KB | None | 0 0
  1. #Region "Non-API"
  2.     Private Sub NonAPI_ProcessCalls()
  3.         Dim PITS = Utilities.HTTP("http://www.wccca.com/PITSv2/Default.aspx", "POST", "__viewstate=") ' WCCCAs Exploit
  4.         If PITS = "ERROR" = False Then
  5.             ' Process WCCCA/CCOM Calls list and filter the end rest of the document then turn it into an array!
  6.             Dim WCCCA = Split(Utilities.processMarkers(Utilities.dtrim(Utilities.dtrim(PITS, "<div id=""ccom-main"" class=""main"">", 1), "<div id=""wccca-incidents"" class=""incidents"">", 0)), "Call Type: ")
  7.             Dim CCOM = Split(Utilities.processMarkers(Utilities.dtrim(Utilities.dtrim(PITS, "<div id=""divTools"">", 1), "<div id=""ccom-incidents"" class=""incidents"">", 0)), "Call Type: ")
  8.             PraseCalls(WCCCA, "W", PITS)
  9.             PraseCalls(CCOM, "C", PITS)
  10.         Else
  11.             Throw New Exception("Error: Cannot load WCCCA PITs data")
  12.         End If
  13.     End Sub
  14.     Private Sub PraseCalls(ByVal ARR As String(), county As String, PITS As String)
  15.         If ARR.Length > 0 Then
  16.             For i As Integer = 0 To ARR.Count - 1
  17.                 If String.IsNullOrWhiteSpace(ARR(i)) = False Then
  18.                     Dim [call] As New Oregon_911_Mainframe.calls
  19.                     [call].setCounty(county)
  20.                     [call].setGUID(Trim(Utilities.txtDelete(Utilities.txtDelete(Utilities.dtrim(Utilities.dtrim(ARR(i), "Time:", 1), "GUID: ", 0), "Time:"), "GUID: ").ToString.ToUpper))
  21.                     [call].setCallType(Utilities.txtDelete(Utilities.dtrim(ARR(i), " Address:", 1), " Address:").ToString.ToUpper)
  22.                     [call].setAddress(Trim(Utilities.txtDelete(Utilities.txtDelete(Utilities.dtrim(Utilities.dtrim(ARR(i), "Address:", 0), " GUID:", 1), "Address: "), " GUID:").ToString.ToUpper))
  23.                     Dim TMP = Utilities.txtDelete(Utilities.dtrim(ARR(i), "Time: ", 0), "Time: ").ToString.Split(" ")
  24.                     Dim TIME_TMP As New List(Of String)
  25.                     For index As Integer = 0 To 4
  26.                         If Not String.IsNullOrWhiteSpace(TMP(index)) Then
  27.                             If TMP(index) = "--:--:--" Then
  28.                                 TIME_TMP.Add("00:00:00")
  29.                             Else
  30.                                 TIME_TMP.Add(TMP(index))
  31.                             End If
  32.                         End If
  33.                     Next
  34.                     [call].setTime(TIME_TMP)
  35.                     [call].setAgency(Utilities.txtDelete(TMP(6), "/"), useAPI)
  36.                     [call].setStation(Utilities.txtDelete(TMP(6), " "))
  37.                     [call].setUnits(Trim(Utilities.txtDelete(dtrim(ARR(i), "Units: ", 0), "Units: ")))
  38.                     [call].setPriority("LOW")
  39.                     [call].setType("UNK")
  40.  
  41.                     Dim GEO_STRING = Utilities.dtrim(Utilities.dtrim(PITS, "LoadMarker(parseFloat(", 0), "updateMarkers();", 1).ToString.Split("LoadMarker(")
  42.  
  43.                     For Each item In GEO_STRING
  44.                         If Not String.IsNullOrWhiteSpace(item) Then
  45.                             Dim GEO_INFO = Utilities.dtrim(item, ";", 1).ToString.Split("', '")
  46.                             If Trim(Utilities.txtDelete(GEO_INFO(3), "'")) = [call].getGUID Then
  47.                                 Dim Geo As New List(Of Double)
  48.                                 If county = "W" Then
  49.                                     If GEO_INFO(5).Contains("wccca") Then
  50.                                         GEO_INFO = GEO_INFO(0).ToString.Split(",")
  51.                                         Geo.Add(Trim(Utilities.txtDelete(Utilities.txtDelete(GEO_INFO(0), "oadMarker(parseFloat("), ")")))
  52.                                         Geo.Add(Trim(Utilities.txtDelete(Utilities.txtDelete(GEO_INFO(1), "parseFloat("), ")")))
  53.                                     End If
  54.                                 Else
  55.                                     If GEO_INFO(5).Contains("ccom") Then
  56.                                         GEO_INFO = GEO_INFO(0).ToString.Split(",")
  57.                                         Geo.Add(Trim(Utilities.txtDelete(Utilities.txtDelete(GEO_INFO(0), "oadMarker(parseFloat("), ")")))
  58.                                         Geo.Add(Trim(Utilities.txtDelete(Utilities.txtDelete(GEO_INFO(1), "parseFloat("), ")")))
  59.                                     End If
  60.                                 End If
  61.                                 [call].setGeo(Geo)
  62.                             End If
  63.                         End If
  64.                     Next
  65.                     AddOrUpdateCall([call])
  66.                 End If
  67.             Next
  68.         End If
  69.     End Sub
  70.     Private Sub NonAPI_PraseUnits()
  71.         For Each incident In database
  72.             Dim temp = ""
  73.             Dim Unit_HTML = Utilities.HTTP("http://www.wccca.com/PITSv2/units.aspx?cn=" & incident.getGUID & "&a=" & incident.getCounty.ToString.ToLower & "&ct=OR911_IMPORT", "POST", "")
  74.             If Unit_HTML = "ERROR" = False Then
  75.                 If Unit_HTML Is Nothing = False Then
  76.                     Dim doc As New HtmlDocument()
  77.                     doc.LoadHtml(Unit_HTML)
  78.                     For Each table As HtmlNode In doc.DocumentNode.SelectNodes("//table")
  79.                         For Each row As HtmlNode In table.SelectNodes("tr")
  80.  
  81.                             temp += incident.getGUID & " " & incident.getCounty & " "
  82.                             For Each cell As HtmlNode In row.SelectNodes("th|td")
  83.                                 If cell.InnerText = "Unit" = False And cell.InnerText = "Dispatch" = False And cell.InnerText = "En Route" = False And cell.InnerText = "On Scene" = False And cell.InnerText = "Clear" = False Then
  84.                                     If String.IsNullOrWhiteSpace(cell.InnerText) = False Then
  85.                                         temp += cell.InnerText.Replace("&nbsp;", "00:00:00") & " "
  86.                                     End If
  87.                                 End If
  88.                             Next
  89.                             temp += vbNewLine
  90.                         Next
  91.                     Next
  92.                 End If
  93.             End If
  94.             Dim temp_split = temp.Split(vbCrLf)
  95.             For i As Integer = 1 To temp_split.Length - 2
  96.                 Dim UNIT_INFO = Utilities.txtDelete(temp_split(i), vbLf).ToString.Split(" ")
  97.                 If UNIT_INFO(0) = incident.getGUID And UNIT_INFO(1) = incident.getCounty Then
  98.                     Dim UNIT As New Oregon_911_Mainframe.units
  99.                     UNIT.setGUID(UNIT_INFO(0))
  100.                     UNIT.setCounty(UNIT_INFO(1))
  101.                     Dim Time As New List(Of String)
  102.                     For Index As Integer = 3 To 6
  103.                         Time.Add(UNIT_INFO(Index))
  104.                     Next
  105.                     UNIT.setTime(Time)
  106.                     UNIT.setUnit(UNIT_INFO(2))
  107.                     AddOrUpdateUnit(incident, UNIT)
  108.                 End If
  109.             Next
  110.         Next
  111.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement