Dre4m Shell
Server IP : 103.6.199.200  /  Your IP : 3.135.204.43
Web Server : Microsoft-IIS/10.0
System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586
User : EMPUSA$ ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Domains/iscommy2/ws.i-3s.com.my/i3sWebServiceStg/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Domains/iscommy2/ws.i-3s.com.my/i3sWebServiceStg/PushSharp.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PushSharp;
using PushSharp.Android;
using PushSharp.Apple;
using PushSharp.Core;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net.Sockets;

namespace i3sWebService
{
    public class PushSharp
    {
        static void Main(string[] args)
        {
            var push = new PushBroker();
            push.OnNotificationSent += NotificationSent;
            push.OnChannelException += ChannelException;
            push.OnServiceException += ServiceException;
            push.OnNotificationFailed += NotificationFailed;
            push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
            push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
            push.OnChannelCreated += ChannelCreated;
            push.OnChannelDestroyed += ChannelDestroyed;


            //Registering the Apple Service and sending an iOS Notification

            var appleCert = File.ReadAllBytes("Certificate");
            //IMPORTANT: If you are using a Development provisioning Profile, you must use
            // the Sandbox push notification server 
            //  (so you would leave the first arg in the ctor of ApplePushChannelSettings as
            // 'false')
            //  If you are using an AdHoc or AppStore provisioning profile, you must use the 
            //Production push notification server
            //  (so you would change the first arg in the ctor of ApplePushChannelSettings to 
            //'true')
            push.RegisterAppleService(new ApplePushChannelSettings(appleCert, ""));
            //Extension method
            //Fluent construction of an iOS notification
            //IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets
            // generated within your iOS app itself when the Application Delegate
            //  for registered for remote notifications is called, 
            // and the device token is passed back to you
            push.QueueNotification(new AppleNotification()
                                       .ForDeviceToken("Phone_Token")  //recipient device id
                                       .WithAlert("Hello World!")       //the message
                                       .WithBadge(7)
                                       .WithSound("sound.caf"));

            //---------------------------
            // ANDROID GCM NOTIFICATIONS
            //---------------------------
            //Configure and start Android GCM
            //IMPORTANT: The API KEY comes from your Google APIs Console App, 
            //under the API Access section, 
            //  by choosing 'Create new Server key...'
            //  You must ensure the 'Google Cloud Messaging for Android' service is 
            //enabled in your APIs Console
            push.RegisterGcmService(new GcmPushChannelSettings("AIzaSyAcec9zNt-5uLZBHAq-BkEvXI-TRhNccvY"));
            //Fluent construction of an Android GCM Notification
            //IMPORTANT: For Android you MUST use your own RegistrationId 
            //here that gets generated within your Android app itself!
            push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(
                                        "DEVICE REGISTRATION ID HERE")
                                         .WithJson("{\"alert\":\"Hello World!\",\"badge\":7,\"sound\":\"sound.caf\"}"));

            push.StopAllServices();

        }
        static void DeviceSubscriptionChanged(object sender,
        string oldSubscriptionId, string newSubscriptionId, INotification notification)
        {
            Console.WriteLine(notification);
        }

        //this even raised when a notification is successfully sent
        static void NotificationSent(object sender, INotification notification)
        {
            Console.WriteLine(notification);
        }

        //this is raised when a notification is failed due to some reason
        static void NotificationFailed(object sender,
        INotification notification, Exception notificationFailureException)
        {
            Console.WriteLine(notificationFailureException);
        }

        //this is fired when there is exception is raised by the channel
        static void ChannelException
            (object sender, IPushChannel channel, Exception exception)
        {
            Console.WriteLine(exception);
        }

        //this is fired when there is exception is raised by the service
        static void ServiceException(object sender, Exception exception)
        {
            Console.WriteLine(exception);
        }

        //this is raised when the particular device subscription is expired
        static void DeviceSubscriptionExpired(object sender,
        string expiredDeviceSubscriptionId,
            DateTime timestamp, INotification notification)
        {
            Console.WriteLine(notification);
        }

        //this is raised when the channel is destroyed
        static void ChannelDestroyed(object sender)
        {
            Console.WriteLine(sender);
        }

        //this is raised when the channel is created
        static void ChannelCreated(object sender, IPushChannel pushChannel)
        {
            Console.WriteLine(pushChannel);
        }

    }
}

Anon7 - 2022
AnonSec Team