Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
southern-company-api
Advanced tools
A Library for pulling power usage data from Southern Company or Southern Company subcompanies
Node.js Library to access utility data from Southern Company power utilities (Alabama Power, Georgia Power, Mississippi Power)
In search of testers with active accounts not in a time of use plan. No coding required, just need to verify API responses. Open an issue if you would like to help.
/* Importing Library */
import {SouthernCompanyAPI} from 'southern-company-api';
/* Or requiring for a script */
var SouthernCompanyAPI = require('../southern-company-api').SouthernCompanyAPI;
/* Instantiating API */
const SouthernCompany = new SouthernCompanyAPI({
username: 'username',
password: 'password',
accounts: ['123123123']
});
/* Listening for login success */
SouthernCompany.on('connected', ()=>{
console.info('Connected...');
async function fetchMonthly() {
/* Getting Monthly Data */
const monthlyData = await SouthernCompany.getMonthlyData();
/* Printing Monthly Data */
console.info('Monthly Data', JSON.stringify(monthlyData));
}
fetchMonthly();
async function fetchDaily() {
/* Getting Daily Data */
const startDate = new Date(2020, 2, 1);
const endDate = new Date();
const dailyData = await SouthernCompany.getDailyData(startDate, endDate);
/* Printing daily data */
console.info('Daily Data', JSON.stringify(dailyData));
}
fetchDaily();
});
/* Listening for any errors */
SouthernCompany.on('error', console.error);
Login by passing username and password as a config object when instantiating.
/* Instantiating API */
const API = new SouthernCompanyAPI({
username: 'username',
password: 'password'
});
The instantiated object extends the EventEmitter class built into node. To listen for events use the .on(eventName, listener)
method.
Current Events:
/* Listening for connection success */
API.on('connected', ()=>{
console.info('Connected...');
});
/* Listening for connection success */
API.on('reconnected', ()=>{
console.info('Reconnected...');
});
/* Listening for any errors */
API.on('error', (error)=>{
console.error('An error occured', error);
});
Description This method collects all monthly data on all accounts from the time they were opened to the last complete month of data.
Arguments
Returns
Promise Return
data
Each index of array is an account retrieved
name
Name of the accountaccountNumber
Account numberdata
Each object of array is a month of data
date
M/YYYY of datacost
Total energy cost for the monthkWh
Total amount of kWh used during the monthbill
Amount billed for the montherror
Description of errorExample
/* Getting Monthly Data */
const monthlyData = await API.getMonthlyData();
/* Printing monthly data */
console.info('Monthly Data', JSON.stringify(monthlyData));
/* Result */
[{
"name":"Apartment",
"accountNumber":0000000000,
"data":[
{"date":"2017-03-01T06:00:00.000Z","cost":66.66,"kWh":416,"bill":87},
{"date":"2017-04-01T06:00:00.000Z","cost":62.23,"kWh":380,"bill":87},
{"date":"2017-05-01T06:00:00.000Z","cost":65.42,"kWh":406,"bill":87}
]
}]
Description
This method collects daily data from the startDate
provided to the endDate
provided.
Arguments
startDate
First date (Date) to include in collectionendDate
Last date (Date) to include in collectionReturns
Promise Return
data
Each index of array is an account retrieved
name
Name of the accountaccountNumber
Account numberdata
Each object of array is a month of data
date
M/D/YYYY of datacost
Total energy cost for the datekWh
Total amount of kWh used during the dateExample
/* Getting Daily Data */
const startDate = new Date(2017, 05, 01);
const endDate = new Date(2017, 05, 02);
const dailyData = await SouthernCompany.getDailyData(startDate, endDate);
/* Printing daily data */
console.info('Daily Data', JSON.stringify(data));
/* Result */
[{
"name":"Apartment",
"accountNumber": 0000000000,
"data":[
{"date":"2017-05-01T06:00:00.000Z", "cost":2.17, "kWh":12.76},
{"date":"2017-05-02T06:00:00.000Z", "cost":77, "kWh":77}
]
}]
Method
GETURL
https://webauth.southernco.com/account/loginRequestVerificationToken
from the login PageRequestVerificationToken
can be found at the bottom of the page in a script tag. Inside the tag the RequestVerificationToken
is assigned to webauth.aft
Method
POSTURL
https://webauth.southernco.com/api/loginHeaders
RequestVerificationToken
: RequestVerificationToken
Content-Type
: application/jsonBody
(JSON Object):
username
: username
password
: password
params
ReturnUrl
'null'ScWebToken
from the JSON response. Can be found in the response.data.html
as a value on a hidden input with the name ScWebTokenScWebToken
from the set cookies from a secondary LoginComplete request.ScJwtToken
) that can be used with the API.Method
GETURL
https://customerservice2.southerncompany.com/Account/LoginValidated/JwtTokenHeaders
Cookie
ScWebToken=ScWebToken
ScJwtToken
from the response's cookiesScJwtToken
can be used to authenticate all other API requests.FAQs
A Library for pulling power usage data from Southern Company or Southern Company subcompanies
The npm package southern-company-api receives a total of 17 weekly downloads. As such, southern-company-api popularity was classified as not popular.
We found that southern-company-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.